don't know how array works??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

don't know how array works???

var touch = [ x =3 , y = 2 , r = "0" , ]; console.log(touch.x+" ,"+ touch.y +" ,"+touch.r); /* in above code, it is saying "undefined". i dont know why.. plz.. Say if you know it.. also tell how to access the value of x, y, and r.. */

12th Mar 2020, 11:43 AM
BlackShadow334
BlackShadow334 - avatar
1 Answer
+ 2
use numeral index, ex. touch[0] to create what you trying to make. initialized it as an object var touch={ x:3, y:2, r:"0" }
12th Mar 2020, 12:27 PM
Taste
Taste - avatar