JavaScript From Beginner To Advanced

0% completed

Previous
Next
Quiz
Which method can be used to split a string into an array of substrings based on a specified separator in JavaScript?
A
split()
B
slice()
C
join()
D
cut()
How do you concatenate two arrays in JavaScript?
A
array1.concat(array2)
B
array1 + array2
C
array1.join(array2)
D
array1.push(array2)
What does the following code output?
let fruits = "apple, banana, cherry";
let fruitArray = fruits.split(", ");
console.log(fruitArray[1]);
A
"apple"
B
"banana"
C
"cherry"
D
"apple, banana, cherry"
How can you check if an array includes a certain value in JavaScript?
A
array.has(value)
B
array.includes(value)
C
array.find(value)
D
array.contains(value)
What is the output of the following code?
let msg = "Hello World";
console.log(msg.toUpperCase());
A
"hello world"
B
"Hello World"
C
"HELLO WORLD"
D
Error
What does the following code snippet return?
let greeting = "Hi there!";
console.log(greeting.charAt(3));
A
't'
B
'h'
C
'i'
D
undefined
Which array method adds elements to the beginning of an array?
A
push()
B
pop()
C
shift()
D
unshift()

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next