Edu
Hub
Courses
AI Tools
Leaderboard
Login/Register
AR
Abdullah Rashid
abdullah@example.com
Navigation
📚
Courses
🏆
Leaderboard
✨
AI Tools
←
JavaScript Basic
⏱
15:00
Quit
0 / 20 answered
0%
JavaScript Basic
10 questions · Medium difficulty · 00:20:00 min
🔥 In Progress
Question 1
What is JavaScript?
A programming language for web interactivity
A styling language
A markup language
A database system
Question 2
How do you write "Hello World" in an alert box?
alertBox("Hello World");
console.log("Hello World");
msgBox("Hello World");
alert("Hello World");
Question 3
Which symbol is used for single-line comments in JavaScript?
<!--
//
/*
#
Question 4
What does the "typeof" operator do?
Checks if a variable is defined
Compares two variables
Returns the data type of a variable
Converts a variable to a string
Question 5
How do you declare a variable in JavaScript?
variable variableName
var, let, or const
declare variableName
v variableName
Question 6
Which method converts a JSON string into a JavaScript object?
JSON.parse()
JSON.convert()
JSON.stringify()
JSON.toObject()
Question 7
What does "===" mean in JavaScript?
Not equal
Assignment operator
Strict equality (value and type)
Equality with type coercion
Question 8
How do you create a function in JavaScript?
new function myFunction() {}
create myFunction() {}
def myFunction() {}
function myFunction() {}
Question 9
What is the correct way to write an array in JavaScript?
var colors = ["red", "green", "blue"];
var colors = red, green, blue;
var colors = (1:"red", 2:"green", 3:"blue");
var colors = "red", "green", "blue";
Question 10
Which event occurs when a user clicks on an HTML element?
onmouseover
onchange
onload
onclick
Question 11
How do you get the length of an array?
array.length
array.count
array.size
array.len
Question 12
What does "NaN" stand for?
Null and None
Negative Arithmetic Notation
No Action Needed
Not a Number
Question 13
Which built-in method adds an element to the end of an array?
array.unshift()
array.shift()
array.pop()
array.push()
Question 14
What is the output of "5" + 3 in JavaScript?
NaN
8
"53"
53
Question 15
How do you stop a form from submitting?
event.cancel()
event.stop()
event.preventDefault()
return false;
Question 16
What does "DOM" stand for?
Data Object Model
Document Oriented Model
Display Object Management
Document Object Model
Question 17
How do you select an element by its ID in JavaScript?
document.getElementById("myId")
document.querySelector(".myId")
document.getElementByClass("myId")
$("#myId")
Question 18
What is the purpose of "console.log()"?
Writes output to the browser console
Displays an alert box
Prints to the screen
Logs errors only
Question 19
Which keyword is used to declare a constant variable?
var
let
const
constant
Question 20
What is a closure in JavaScript?
A way to declare private variables only
A built-in JavaScript object
A loop that runs forever
✅ Answered:
0
⬜ Unanswered:
8
📊
20%
done
Submit Answers →