What will be the output of the following JavaScript code? Code: let x = 30; if (x % 2 === 0) { console.log('Even'); } else { console.log('Odd'); }
A). A) Even
B). B) Odd
C). C) 30
D). D) None of the above
What will be the output of the following JavaScript code? Code: let x = 25; if (x % 2 === 0) { console.log('Even'); } else { console.log('Odd'); }
A). A) Even
B). B) Odd
C). C) 25
D). D) None of the above
What will be the output of the following JavaScript code? Code: let x = 15; if (x % 2 === 0) { console.log('Even'); } else { console.log('Odd'); }
A). A) Even
B). B) Odd
C). C) 15
D). D) None of the above
What will be the output of the following JavaScript code? Code: console.log('Hello' + 1 + 2);
A). A) Hello12
B). B) Hello3
C). C) Hello
D). D) TypeError: cannot convert number to string
What will be the output of the following JavaScript code? Code: console.log(2 + 2 + '2');
A). A) 42
B). B) 22
C). C) 4'2'
D). D) '22'
What will be the output of the following JavaScript code? Code: let x = 35; if (x % 2 === 0) { console.log('Even'); } else { console.log('Odd'); }
A). A) Even
B). B) Odd
C). C) 35
D). D) None of the above
What does the following JavaScript code snippet do? Code: let a = 10; let b = 20; let temp = a; a = b; b = temp; console.log(a, b);
A). A) Swaps the values of a and b
B). B) Adds a and b
C). C) Checks if a is equal to b
D). D) Multiplies a and b
What will be the output of the following JavaScript code? Code: let x = 8; if (x % 2 === 0) { console.log('Even'); } else { console.log('Odd'); }
A). A) Even
B). B) Odd
C). C) 8
D). D) None of the above
What will be the output of the following JavaScript code? Code: let x = 40; if (x % 2 === 0) { console.log('Even'); } else { console.log('Odd'); }
A). A) Even
B). B) Odd
C). C) 40
D). D) None of the above
What does the following JavaScript code snippet do? Code: let x = 'Hello'; let y = x.length; console.log(y);
A). A) Stores the length of the string x in y
B). B) Converts x to uppercase
C). C) Converts x to lowercase
D). D) Finds the index of a character in x