-
Read all instructions before beginning the assessment
-
FORK this repository
-
The FIRST 5 questions in this exam test your knowledge of JavaScript arrays, objects, loops, conditions, writing functions, and string manipulation.
-
The SECOND 5 questions in this exam test your knowledge of manipulating the DOM via JavaScript.
-
Write your solutions to the problems inside
solutions.js. NOTE: please use jQuery and BOM methods for this assessment. Allowing the use of vanilla JS DOM methods is up to the instructor. Please ask your instructor for clarification before the assessment begins. -
Add and commit throughout the assessment
-
Don't push your branch until the end of the assessment!
THE FIRST FIVE PROBLEMS are followed by code samples that demonstrate using the functions. The code samples are intended to show the expected inputs and outputs to the functions, but are not themselves part of the solution.
THE SECOND FIVE PROBLEMS involve calling various DOM and/or BOM functions to achieve certain visual effects in index.html. You do NOT need to put your JavaScript for the DOM questions in your own functions.
Do NOT modify the HTML attributes or structure. Use jQuery DOM methods and BOM methods in your solutions.
The FIRST 5 questions in this exam test your knowledge of JavaScript arrays, objects, loops, conditions, writing functions, and string manipulation.
The SECOND 5 questions in this exam test your knowledge of manipulating the DOM via JavaScript. You may use vanilla JS or jQuery or both.
-
Write a function called
isBooleanthat returns true if the parameter has a data type of boolean. Otherwise, it returns false. Examples: console.log(isBoolean(42)); // outputs false console.log(isBoolean("true")); // outputs false console.log(isBoolean(false)); // outputs true -
Write a function called
hasBooleanthat returns true if the array parameter contains at least one element that is a boolean. Otherwise, it returns false. Examples:
console.log(hasBoolean([1, 2, 3, 4])); // outputs false
console.log(hasBoolean([1, "false", 3, 4])); // outputs false
console.log(hasBoolean([1, 2, true, 4])); // outputs trueUse the following data to answer questions 3 through 5:
const people = [ {
name: "Bob",
age: 42
}, {
name: "Sue",
age: 27
}, {
name: "Lou",
age: 33
}, {
name: "Zanzibar",
age: 18
}, {
name: "Gladys",
age: 39
}
];- Write a function called
minAgethat takes an array of people as a parameter and returns the smallest age in the array. Example:
console.log(minAge(people)); // outputs 18- Write a function called
longestNamethat takes an array of people as a parameter and returns the longest name in the array. Example:
console.log(longestName(people)); // outputs Zanzibar- Write a function called
createPersonthat takes a name parameter and an age parameter and returns an object containing the given name and age as properties. Example:
const jimbob = createPerson("Jimbob", 22);
console.log(jimbob);
/* outputs
{
name: "Jimbob",
age: 22
}
*/-
When the button with an id of
bold-btnis clicked, that button's font weight should change tobold. -
When the button with an id of
reload-btnis clicked, the page should reload (i.e., refresh). -
Whenever a list item with a class of
loud-itemis clicked, display that list item's text in analert(). -
Whenever a list item with a class of
data-itemis hovered over, display that list item'sdata-idvalue in the span with an id ofdata-display. -
Whenever the button with an id of
change-text-btnis clicked, change that button's text to whatever has been typed in the input with an id ofchange-text-input.