Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

javascript help with variables

Name: Anonymous 2012-11-03 13:02

With some help, I wrote this javascript.

http://pastebin.com/uSSZp0j6

I don't understand how to add more than one variable to a variable, I need for there to be several "keycodes," not just one. Other than that, the script works fine.

Name: Anonymous 2012-11-03 13:03

Line 10 specifically is what I need help with

Name: Anonymous 2012-11-03 13:06

Oh god that is some horrible HTML/Javascript.

Name: Anonymous 2012-11-03 13:50

DOXEADO por: D4rk_Floyd & Anonymous Panama


Alfredo Reid --> @Pipison21 <--Este pedofilo merece MORIR.

Nacio el:
Febrero 21, 1983

Graduado del:
Instituto Jose Dolores Moscote
IPTC de Comercio

Cuenta personal de Facebook:
https://www.facebook.com/dj.junier.infiltrado

Cuenta personal de twitter:
@junier2101

Foto:
pic.twitter.com/MvpsWoOi

BlackBerry pin:


Lugar donde vive:
Habita en Panamá,
ciudad de Panamá,
Dentro de San Joaquin,
calle Colon.


No debemos resaltar que esta persona es un pedofilo por sus fotos tanto en redes sociales anonimas como en las personales, le pedimos a la policia nacional que le de sancion por esto ya que es una AMENAZA para los niños dentro de la red...

Pruebas de que es un pedofilo con pruebas en fotografia de una converzacion utilizando ingenieria inversa para revelar su verdadera cara:
pic.twitter.com/GBTMeZWb
pic.twitter.com/0Knd9aqV


Saludos a todos Somos Anonymous
Somos Legion
No perdonamos
No olvidamos
Pedofilos
Ya llegamos ;D

Name: Anonymous 2012-11-03 13:54

>>4
Well done, dipshit (not really)

Name: Anonymous 2012-11-03 21:56


var keycodes = new Array("apples", "grapes", "oranges")

x = "incorrect"
for (i = 0; i < keycodes.length; i++)
  if (y == keycodes[i])
    x = "correct"

Name: Anonymous 2012-11-04 10:17

>>6

op here, thanks a lot. I wasn't familiar with how to make variable arrays.

With the array variables, it seems like your method is the only way to make the script work, my "if else" way of doing it doesn't work with the variable arrays. Could somebody explain why? Also, your way of doing it is cryptic to me. I don't understand what "i" does, I need to go read up on it.

thanks again, I really appreciate it.

Name: Anonymous 2012-11-04 23:37

>>7
he is getting a list of things addressable by index - array:
var keycodes = new Array("apples", "grapes", "oranges")
affecting a temporary variable to hold the text
x = "incorrect"
then cycling thru all elements of the above mentioned array; to do this he makes use of a temporary variable i, of value 0, 1, and so on until the length of the array minus 1.
for (i = 0; i < keycodes.length; i++)
at each iteration of the cycle he tests if the code at that position of the array is the same at the one held by the variable y, and if so, affects x
  if (y == keycodes[i])
    x = "correct"

Name: Anonymous 2012-11-05 21:59

>>8
+1, Helpful

Name: Anonymous 2012-11-05 22:08

>>9
+1, le monkey face

Name: Anonymous 2012-11-19 15:24

checking help with doubles

Name: Anonymous 2012-11-19 18:12

>>6,8
Please stop programming! new Array? for in 2012? Come on! This is JavaScript, emphasis mine!!!

var keycodes = { "apples":1, "grapes":1, "oranges":1 }
if (y in keycodes)
    x = "correct"
else
    x = "incorrect"

Name: Anonymous 2012-11-19 18:13

>>12
JavaShit? Stop programming!

Name: Anonymous 2012-11-19 18:15

>>13
You're just mad I fixed your shitty Java-like code.

Name: Anonymous 2012-11-19 18:47

>>14
What? It's the first time I post in this thread, no way I'd program in Java or JavaShit

Name: Anonymous 2012-11-19 19:35

>>15
I get it, you think Java is shit. So do I.
I also don't think Javascript is very good.

Name: Anonymous 2012-11-19 19:40

>>16
Java is shit, Javascript is shit, you're new shit and should fuck off back to /g/ already

Name: Anonymous 2012-11-19 19:42

>>17
You're projecting. FrozenVoid drove me away two years ago and I'm back with a vengeance, cretin.

Name: Anonymous 2012-11-19 20:52

>>18
CURTAIL MY ANUS

Name: Anonymous 2012-11-19 21:56

>>18
So what brought you back, moot.

Name: Anonymous 2012-11-20 1:49

     ♪  ☆
   ♪   / \       OPPA
      ヽ( ͡° ͜ʖ ͡°)ノ   GANGNAM STYLE
         (  へ)    
          く       

   ♪    ☆
     ♪ / \    
      ヽ( ͡° ͜ʖ ͡°) ノ  OPPA
         (へ  )    GANGNAM STYLE
             >    

Name: Anonymous 2012-11-20 4:00

>>20
Procrastination and a newfound sense of masochism.

Name: Anonymous 2012-11-20 6:47

>>21
Take your Gungan oppai back to /b/, please..

Name: Anonymous 2012-11-20 7:45

>>22
What are you procrastinating?

Name: Anonymous 2012-11-20 8:36

>>24
Mostly university stuff. Could you quit with the third-degree, or at laest start using sage?

Name: sage 2012-11-20 16:02

>>21
You misspelled oppan... twice.

Name: Anonymous 2012-11-20 19:38

>>26
*Oppai

Name: Anonymous 2012-11-20 20:09

>>12
Arrays are fine (although new Array is pointless). The in operator is dangerous as it returns true when a property is found anywhere in an object's prototype chain, which is not what you want in this case. It's also no faster than a simple array iteration. [1]

[1] http://jsperf.com/in-vs-array-iteration

Name: Anonymous 2012-11-21 5:00

>>28
Oh right. I knew about the prototype chain but wanted to keep it simple (i.e. not use hasOwnProperty).
Is that test meant to not feature the in operator at all? All four tests are array iteration.

Name: Anonymous 2012-11-21 5:06

>>29
Also, it's not always about performance. Readability is clearly the more important factor here. And since you're essentially doing an in test every time you access an object property, it's really not ever going to be the bottleneck.

Name: Anonymous 2012-11-21 8:46

>>29
You ruined my test case

Don't change these.
Name: Email:
Entire Thread Thread List