What is wrong with the following code?
function sayHello() {
console.log "Hello World!";
==
Identify the error
let x = 5
if(x > 3) {
console.log("x is greater than 3")
==
Why does this throw an error?
let name = "Alice";
console.log(Name);
==
Why does this code cause an error?
console.log(myVar);
let myVar = 10;
==
Why does this function return undefined?
function multiply(a, b) {
a * b;
console.log(multiply(2, 3));
==
What happens when calling this function?
function addNumbers(a, b) {
return a + b;
console.log(addNumbers(2));
==
What is the issue with this loop?
for (let i = 0; i < 5; i-- ) {
console.log(i);
==
Why is map() not returning the expected array?
let arr = [1, 2, 3, 4];
let doubled = arr.map(num => { num * 2 });
console.log(doubled);
==
What is wrong with this forEach loop?
let numbers = [1, 2, 3, 4];
numbers.forEach(num => {
if (num % 2 === 0) break;
});
==
What is the error:
let i = 1;
while (i <= 5) {
console.log(i);
==
What is the error:
for (let i = 0; i < 3; i--) {
console.log(i);
==
What is the error:
for (let i = 0; i <= 10; i += 2); {
console.log(i);