JAVASCRIPT QUIZ
1 .
What is negative infinity in Java script?

number in JavaScript, derived by dividing negative number by zero
2 .
Where do you use the “break” statement?

To terminate a switch statement, loop, or labeled block.
3 .
What is the value of x?
var x = ‘1’+2+3;

“123”
4 .
Which of these will throw a SyntaxError?

if (x ==== 1) { }
5 .
Whats the output of the below
``````for(var i = 0; i < 10;i++){
setTimeout(function(){console.log(i) }, 10)
}​``````

10 10 10 10 10 10 10 10 10 10
6 .
How do you check what the type of a value in variable x is?
var x = { ftl: "bar" }

type(x);
7 .
What will be the output of the following JavaScript code?
``````<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = Number.NEGATIVE_INFINITY;
}
</script>``````

-infinity
8 .
What will be the output of the following JavaScript code?
``````<p id="demo"></p>
<script>
function myFunction() {
var num = 5.56789;
var n = num.toExponential();
document.getElementById("demo").innerHTML = n;
}
</script>``````

5.56789e+0
9 .
What will be the output of the following JavaScript code if oddsums(5); is executed after the following code snippet?
``````function oddsums(n) {
let total = 0, result=[];
for(let x = 1; x <= n; x++)
{
let odd = 2*x-1;
total += odd;
result.push(total);
}
return result;
}``````