Javascript
general scripting
jQuery
arrays
data validation and transformation
100

True or False, the same symbol in JS is used to add numbers and strings.

T

100

To output information to a pop-up box you use the command

alert()

100

True or False, you can start a line of jQuery with $ or jQuery

T

100

True or False, the first object in an array is position 1

F

100

True or False, the letter "m" in sample is at character position 3 of the string.

F

200

In JS: To set the font color to red of an object IDed as name you would type.

document.querySelector("#name").style.color = 'red'

200

To output information to the javascript/error console you use the command

console.log()

200

Write the jQuery code that would fade out the element IDed as box1 over 3 seconds.

$("#box1").fadeOut(3000)

200

To add a new value "blue" to the colors array you would type.

colors.push("blue")

200

The ______ command extracts part of a string, and takes ____ inputs.

substring()     and     2

300

To call the function checkage with the contents of the #age textbox, you would type

checkage(document.querySelector("#age").value)

300

True or False, Javascript is one of the most popular frameworks or libraries on the Web.

F   

300

Write the jQuery that would set up a click trigger on the object IDed as button1, that would animate a slide down on the object IDed as infobox.

$("#button1").on("click", function(){

       $("#infobox").slideDown()

}

300

To output to the document the value of the fifth item in the photourl array you would type...

document.write(photurl[4])

300

The _____ command tries to find a string within a string.

indexOf()

400
The statement that brings up an alert "You can vote" if the variable age is equal or greater to 18 is

if(age>=18) {

   alert('You can vote!')

}

500

Write the Javascript that would create a new function named setcolor, which takes one input variable named newcolor, and sets the background color of the page to that color when it is called.

var setcolor = function(newcolor){    document.querySelector("body").style.backgroundColor =  newcolor

}

M
e
n
u