JavaScript Fundamentals
Master the basics of JavaScript with questions on variables, functions, arrays, and DOM manipulation.
10 Questions
beginner
Quiz Questions
-
Which keyword is used to declare a constant in JavaScript?
-
What is the result of typeof null in JavaScript?
-
'null'
-
'undefined'
-
'object'
-
'boolean'
-
How do you write 'Hello World' in an alert box?
-
alertBox('Hello World')
-
alert('Hello World')
-
msg('Hello World')
-
popup('Hello World')
-
Which method adds an element to the end of an array?
-
push()
-
pop()
-
shift()
-
unshift()
-
What does === operator check?
-
Value only
-
Type only
-
Both value and type
-
Neither
-
How do you create a function in JavaScript?
-
function myFunction()
-
create myFunction()
-
def myFunction()
-
func myFunction()
-
What is the correct way to write a JavaScript array?
-
var colors = 'red', 'green', 'blue'
-
var colors = (1:'red', 2:'green', 3:'blue')
-
var colors = ['red', 'green', 'blue']
-
var colors = 1 = ('red'), 2 = ('green'), 3 = ('blue')
-
Which event occurs when the user clicks on an HTML element?
-
onmouseclick
-
onclick
-
onchange
-
onmouseover
-
What is NaN in JavaScript?
-
A string
-
A number
-
Not a Number
-
Null and None
-
How do you find the length of an array named 'arr'?
-
arr.length
-
arr.size()
-
arr.len
-
length(arr)