Podcast
Questions and Answers
Which of the following is a valid data type in JavaScript?
Which of the following is a valid data type in JavaScript?
- String (correct)
- Float
- Character
- Boolean
What is the purpose of the 'querySelector' method in JavaScript?
What is the purpose of the 'querySelector' method in JavaScript?
- To add an event listener to an element
- To select an element from the DOM based on a CSS selector (correct)
- To define a new JavaScript function
- To create a new HTML element
What is the difference between 'null' and 'undefined' in JavaScript?
What is the difference between 'null' and 'undefined' in JavaScript?
- 'null' is a keyword in JavaScript, while 'undefined' is a built-in function
- 'null' represents the absence of a value, while 'undefined' indicates that a variable has been declared but has not been assigned a value (correct)
- 'null' and 'undefined' are interchangeable and can be used interchangeably
- 'null' and 'undefined' both represent the absence of a value, but 'null' is used for objects and 'undefined' is used for variables