+ 1

What is the syntax of Array containing 1 integer???

var name=new Array(3); The above statement creates empty array with length of 3 elements. What is the syntax of Array containing 1 integer???

22nd Apr 2017, 5:43 PM
Sandip Bhambre (Sandy)
Sandip Bhambre (Sandy) - avatar
3 ответов
+ 6
var myArr = [42]; this is an array with one element, the number 42 just another valid way to go
22nd Apr 2017, 6:20 PM
Burey
Burey - avatar
+ 1
if you do var arr=new Array() arr(0)=1 you have an array with one integer
22nd Apr 2017, 5:50 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar