Loading...
Quiz String Methods
I have research, shortlist and designed this quiz according to JavaScript strings and string methods for all the learners of devscall.
1.
How do you define a string in JavaScript?
2.
What does the following output?
javascript
2 lines
|14/ 500 tokens
1 2let message = "It's a sunny day!"; console.log(message);
Code Tools
3.
What is the output of this code?
javascript
2 lines
|13/ 500 tokens
1 2let text = "JavaScript"; console.log(text.length);
Code Tools
4.
What will be the result of this code?
javascript
2 lines
|14/ 500 tokens
1 2let text = "JavaScript"; console.log(text.charAt(2));
Code Tools
5.
What does the following code return?
javascript
3 lines
|19/ 500 tokens
1 2 3let name = "Alice"; let greeting = `Hello, ${name}!`; console.log(greeting);
Code Tools
6.
What will be the result of this code?
javascript
3 lines
|20/ 500 tokens
1 2 3let text = "JavaScript is fun"; let part = text.slice(0, 10); console.log(part);
Code Tools
7.
Which method splits a string into an array based on a separator?