XJavascript.com
Toggle Menu
Home
Online Javascript Compiler
Tutorials
JavaScript Tutorials
TypeScript Tutorials
Blog
All Posts
JavaScript Fundamentals
Test your grasp of variables,data types,and basic syntax in JavaScript.
1. Which keyword is block-scoped and cannot be reassigned?
var
let
const
2. What is the result of 3 + '3' in JavaScript?
6
"33"
33
NaN
3. Which is NOT a primitive data type in JavaScript?
String
Object
Boolean
Number
4. What does typeof null return?
"null"
"object"
"undefined"
"symbol"
5. Which array method removes the last element?
push()
pop()
shift()
unshift()
6. Select all falsy values in JavaScript:
0
""
null
true
"false"
7. Which are valid loop structures in JavaScript?
for
while
do-while
foreach
repeat
8. Which are valid ways to declare a function?
function greet() {}
const greet = function() {}
const greet = () => {}
greet: function() {}
9. Which operators check for equality?
===
==
=
!==
!=
10. Which are primitive data types?
String
Number
Boolean
Array
Symbol
11. Variables declared with 'var' are function-scoped.
True
False
12. In browsers, 'this' in a global function refers to the window object.
True
False
13. JavaScript is a statically typed language.
True
False
14. The '===' operator compares both value and type.
True
False
15. Array.prototype.map() modifies the original array.
True
False
16. What is the standard file extension for JavaScript files?
17. What method converts a JavaScript object to a JSON string?
18. What keyword declares a variable that can be reassigned but not redeclared?
19. What is the output of 'typeof 42'?
20. What abbreviation refers to the global object in Node.js?
Reset
Answered 0 of 0 — 0 correct