We have tried to cover maximum javascript interview questions possible - For Freshers and Experienced UI Developers
Now we are creating array
var x = [1,2,3,5,6]; // declaring x
console.log(x); //output: [1, 2, 3, 5, 6]
How to use Loop for array
x.forEach(function(item,index){
console.log(index,item)
})
output :-
0 1
1 2
2 3
3 5
4 6
Remove first element from array
var first = x.shift() // [2,3,5,6]
Add element front of array
var last = x.unshift(1) // [1,2,3,5,6]
Array Values
var x = [5,6,4,2,3,7,3,4,5,7,7,3,2,1]; // Answer ?
var x = 1+"1"+"1" // console.log(x)
var x = 1-"1"+"2" // console.log(x)
var x = +1-"1"+"1" // console.log(x)
var x = 1+ +"1"+"2" // console.log(x)
var x = "2"-"1"+"1" // console.log(x)
Var x = "TestJavascript";
Var x = "TestJavascript"; //Output ?
Var x = "TestJavascript"; //Output ?