HTML5: JavaScript & the DOM

HTML5: JavaScript & the DOM

memorize.aimemorize.ai (lvl 286)
Section 1

Preview this deck

True or false: JavaScript is case-insensitive

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

0

All-time users

0

Favorites

0

Last updated

4 years ago

Date created

Mar 1, 2020

Cards (66)

Section 1

(50 cards)

True or false: JavaScript is case-insensitive

Front

false

Back

After execution, the program statement: 'var winner;' will be assigned the value ________

Front

undefined

Back

True or false: There as some slight performance advantages to adding your JavaScript code at the end of the body of a web page.

Front

true

Back

Complete command to change the content of element named 'myPlanet' to "Red Alert: Hit by Phaser Fire!"

Front

myPlanet.innerHTML = "Red Alert: Hit by Phaser Fire!";

Back

Complete command to target an HTML element with an id of 'earth' and assign it to a storage location of 'myPlanet'

Front

var myPlanet = document.getElementById("earth");

Back

2 Keywords related to making decisions

Front

if, else

Back

Some languages use _____ ______ to indicate the nature of the information stored in a variable

Front

data types

Back

Shell/stub code required to make sure a code does not execute until after a page is fully loaded in a browser

Front

<script>function init(){//stuff here}window.onload=init;</script>

Back

Containers for holding values

Front

variables

Back

Best naming practices goal #3:

Front

Use variables that begin with _ or $ only with very good reason

Back

Write a statement to create a variable called myPropaganda that is assigned the phrase: I love JavaScript!

Front

var myPropaganda = "I love JavaScript!";

Back

Termination symbol for a JavaScript command line

Front

semicolon

Back

One-way selection structure syntax

Front

if(<boolean condition>){//stuff goes here}

Back

Relational operator that checks numeric equality

Front

==

Back

DOM

Front

Document Object Model

Back

Create a variable called 'die' that generates a random integer in [1,6]

Front

var die = 1 + Math.floor(Math.random()*6);

Back

Rule 2 in naming variables:

Front

May use any number of letters, numeric digits, underscores or dollar signs

Back

Result of Math.floor(7.9999)

Front

7

Back

Rule 1 in naming variables:

Front

Start variables with a letter an underscore or a dollar sign

Back

Basic HTML5 container for a JavaScript set of instructions

Front

<script>//code goes here</script>

Back

Pre-condition loop syntax structure

Front

while(<boolean statement>){/* stuff here */}

Back

Keyword indicating 'no value'

Front

null

Back

Best naming practices goal #2:

Front

Use camelCase when creatingMultiwordVariableNames

Back

Keyword to indicate that a word is to be used to store a number or string of characters

Front

var

Back

Result of Math.ceil(1.01)

Front

2

Back

Assignment operator

Front

=

Back

Single line comment structure for JavaScript

Front

//

Back

3 Keywords that indicate repetition

Front

do, while, for

Back

True or false: JavaScript heavily requires the use of typed variables

Front

false

Back

Fixed iteration loop syntax structure

Front

for(<initialization>; <continue condition>; <update condition>){/* stuff here */}

Back

Rule 3 in naming variables:

Front

Avoid all of JavaScript's reserved words

Back

Extension of a JavaScript file

Front

js

Back

4 Benefits of the DOM

Front

1. Retrieve elements 2. Create or add elements3. Remove elements 4. Get and set element attributes

Back

Create a variable called 'myRandom' that generates a random number anywhere in [0,10)

Front

var myRandom = Math.random()*10;

Back

JavaScript has _______ typing

Front

dynamic

Back

The standard character set in use on the Web

Front

UTF-8

Back

Expressions that evaluate to being either true or false

Front

boolean

Back

True or false: A JavaScript variable can hold a number, string or boolean

Front

true

Back

Create a variable called 'user' that targets an element with an id of 'registrant'

Front

var user = document.getElementById("registrant");

Back

Correct the statement: 13 = var unlucky;

Front

var unlucky = 13;

Back

API

Front

Application Programming Interfaces

Back

Result of Math.floor(5.1)

Front

5

Back

Process where the JavaScript interpreter will figure out the nature of the information a variable contains as the code runs

Front

dynamic typing

Back

Write a command that creates a pop-up window that says, "Hello World!"

Front

alert("Hello World");

Back

The browser's internal representation of a web page

Front

DOM

Back

Two-way selection structure syntax

Front

if(<boolean condition>){//do this}else{//otherwise this}

Back

Built-in function that creates a pop-up window

Front

alert( );

Back

Given: color != "pink"; //What's the result if color is blue?

Front

false

Back

Best naming practices goal #1:

Front

Choose names that mean something

Back

Math.random() generates any number in this range

Front

[0, 1)

Back

Section 2

(16 cards)

Create an array called 'stooges' that contains Moe, Larry and Curly

Front

var stooges = ["Moe", "Larry", "Curly"];

Back

You make your web pages ____ by examining and changing the ____ using JavaScript

Front

interactive...DOM

Back

Multiplication operator in JavaScript

Front

*

Back

You have an array that contains the 50 states in the US. What is the index (room number) of the first state?

Front

0

Back

You have an array that contains the 50 states in the US. What is the index (room number) of the last state?

Front

49

Back

If 'j' is currently 13, what is j--?

Front

12

Back

____ is a JavaScript library with several math related functions in it

Front

Math

Back

If x is currently 8, what is the result of the statement: x+=9?

Front

17

Back

Variables, defined with the 'var' keyword and located outside of any function defintion are said to be _____

Front

global

Back

The process of 'gluing' phrase fragments together to form a larger phrase

Front

concatenation

Back

The ____ property of an array tells you how many items it contains

Front

length

Back

_____ a JavaScript variable using 'var'

Front

Declare

Back

Concatenation operator in JavaScript

Front

+

Back

Create an array called bodyParts that is initally 'empty' and waiting to be filled with values

Front

var bodyParts = new Array();

Back

A JS phrase used to determine when a page has finished loading in the browser

Front

window.onload

Back

If 'i' is currently 12, what is i++?

Front

13

Back