JAVASCRIPT COMPREHENSIVE EXAM 2026/2027
QUESTIONS AND SOLUTIONS RATED A+
✔✔clearInterval - ✔✔cancels a timed, repeating action which was previously
established by a call to setInterval().
✔✔intervalId - ✔✔let intervalID = setInterval(function() { console.log("Happening every
500ms!"); }, 500);
clearInterval(intervalID);
✔✔Object LIteral - ✔✔A comma-separated list of name-value pairs wrapped in curly
braces.
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
✔✔document.querySelector() - ✔✔Returns the first Element within the document that
matches the specified selector, or group of selectors, or null if no matches are found.
✔✔document.querySelectorAll() - ✔✔Returns a list of the elements within the document
(using depth-first pre-order traversal of the document's nodes) that match the specified
group of selectors. The object returned is a NodeList.
✔✔.addEventListener - ✔✔('click' ( ) {
p.textContent = input.value
})
✔✔.textContent - ✔✔similar to .innerHTML
✔✔.innerHTML - ✔✔can read and alter the elements on a webpage
✔✔return - ✔✔ends function execution and specifies a value to be returned to the
function caller
✔✔ternary - ✔✔this.items = items !== undefined ? items : [];
(if items is undefined, return items; otherwise return the array)
✔✔<script>
var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"];
// ES5
// for(var i = 0; i < toys.length; i++){
// console.log(toys[i]);
// }
, </script> - ✔✔for loop that prints all items in array
✔✔<script>
var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"];
// ES6
// for(var toy of toys){
// console.log(toy);
// }
</script> - ✔✔for of loop that prints all items in array
✔✔<script>
var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"];
// jQuery
// $.each(toys, function(index, value){
// console.log(value);
// });
</script> - ✔✔The $.each() function internally retrieves and uses the length property of
the passed collection.
✔✔button.addEventListener('click', () => {
p.innerHTML = input.value + ':';
}); - ✔✔When the button is clicked, the text between the <p> tags is changed per what
is typed into input box
✔✔What is a dataset? - ✔✔The dataset property on the HTMLElement interface
provides read/write access to all the custom data attributes (data-*) set on the element.
This access is available both in HTML and within the DOM. It is a map of DOMString,
one entry for each custom data attribute.
✔✔Math.floor() - ✔✔A function that returns the largest integer less than or equal to a
given number.
✔✔parseFloat() - ✔✔This function parses a string and returns a floating point number.
This function determines if the first character in the specified string is a number. If it is, it
parses the string until it reaches the end of the number, and returns the number as a
number, not as a string.
✔✔parseInt() - ✔✔This function parses a string and returns an integer. (Only the first
number gets returned.)
QUESTIONS AND SOLUTIONS RATED A+
✔✔clearInterval - ✔✔cancels a timed, repeating action which was previously
established by a call to setInterval().
✔✔intervalId - ✔✔let intervalID = setInterval(function() { console.log("Happening every
500ms!"); }, 500);
clearInterval(intervalID);
✔✔Object LIteral - ✔✔A comma-separated list of name-value pairs wrapped in curly
braces.
var person = {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"};
✔✔document.querySelector() - ✔✔Returns the first Element within the document that
matches the specified selector, or group of selectors, or null if no matches are found.
✔✔document.querySelectorAll() - ✔✔Returns a list of the elements within the document
(using depth-first pre-order traversal of the document's nodes) that match the specified
group of selectors. The object returned is a NodeList.
✔✔.addEventListener - ✔✔('click' ( ) {
p.textContent = input.value
})
✔✔.textContent - ✔✔similar to .innerHTML
✔✔.innerHTML - ✔✔can read and alter the elements on a webpage
✔✔return - ✔✔ends function execution and specifies a value to be returned to the
function caller
✔✔ternary - ✔✔this.items = items !== undefined ? items : [];
(if items is undefined, return items; otherwise return the array)
✔✔<script>
var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"];
// ES5
// for(var i = 0; i < toys.length; i++){
// console.log(toys[i]);
// }
, </script> - ✔✔for loop that prints all items in array
✔✔<script>
var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"];
// ES6
// for(var toy of toys){
// console.log(toy);
// }
</script> - ✔✔for of loop that prints all items in array
✔✔<script>
var toys = ["jacks", "matchbox cars", "yo-yos", "marbles"];
// jQuery
// $.each(toys, function(index, value){
// console.log(value);
// });
</script> - ✔✔The $.each() function internally retrieves and uses the length property of
the passed collection.
✔✔button.addEventListener('click', () => {
p.innerHTML = input.value + ':';
}); - ✔✔When the button is clicked, the text between the <p> tags is changed per what
is typed into input box
✔✔What is a dataset? - ✔✔The dataset property on the HTMLElement interface
provides read/write access to all the custom data attributes (data-*) set on the element.
This access is available both in HTML and within the DOM. It is a map of DOMString,
one entry for each custom data attribute.
✔✔Math.floor() - ✔✔A function that returns the largest integer less than or equal to a
given number.
✔✔parseFloat() - ✔✔This function parses a string and returns a floating point number.
This function determines if the first character in the specified string is a number. If it is, it
parses the string until it reaches the end of the number, and returns the number as a
number, not as a string.
✔✔parseInt() - ✔✔This function parses a string and returns an integer. (Only the first
number gets returned.)