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