Level 25 Level 27
Level 26

[Quiz] Basics VIII

102 words 0 ignored

Ready to learn       Ready to review

Ignore words

Check the boxes below to ignore/unignore words, then click save at the bottom. Ignored words will never appear in any learning session.

All None

What constitutes whitespace?
Spaces, tabs and newlines used outside of string constants are called whitespace and, unlike other programs this whitespace can directly impact semantics.
How does whitespace affect javascript?
A technique called "automatic semicolon insertion" (ASI), some statements that are well formed when a newline is parsed will be considered complete (as if a semicolon were inserted just prior to the newline)
How do you protect against automatic semicolon insertion?
Statement-terminating semicolons may lessen unintended effects of the ASI.
What are characters are problematic in javascript?
5 characters are commonly problematic. The open parenthesis "(", the open bracket "[", the slash "/", the plus "+" and the minus "-"
What character can be used so it does not accidentally join the previous statement?
A semicolon as the first character. Also known as the defensive semicolon or the initial semicolon.
With 2 slashes. //
How do you declare a single line comment?
How do you declare a multi-line comment?
With a slash star, ending with a star slash: /** hello **/
What is JavaScript?
A scripting language is a lightweight programming language that is utilized as a code that is inserted into HTML pages.
True or False, when a form is submitted by calling the submit function via JavaScript, the submit event is fired.
How can you call for an external script?
External scripts should end with .js and is called within the script tag using the src attribute.
A semicolon separates statements.
What is the purpose of a semicolon?
What is a block?
A block is a group of statements whose purpose is used to execute together.
What character designates a block?
A block begins with a left curly bracket and ends with a right curly bracket.
How is a backslash used?
You can break up a text string with a backslash. The example below will be displayed properly:
Variable values are called _______
declare the value
variables: 2 steps to use a var
var a = 1;
variables: declare & initialize in single statement
variables: several w single statement
var v1, v2 = 'hello', v4 = 4, v5;
variables: Case sensitive
var case_matters = 'lower';
What tag is used to embed JS code into HTML?
use underscore
php naming convention is _______
string, numbers, and boolean
three basic data types in js
operator: +
var sum = 4 + 5;
Adds two values together or concatenates two strings into a single string.
var num = parseInt("34",10);
Parse a string to base 10 value
are the _______ parameter of parseInt function
not a number - is returned if parseInt encounters a character which is not a number. For example,
var num = 3;
Create a function that ha a parameter. The function should return 5times the parameter value.
function (paramOne)
Give an example of anonymous function
var multiplesOfFive = function (paramOne)
Assign a function to a variable
Functions are values
length = obj.length;
var firstIndexOfIs = obj.indexOf("is");
var fromRightToLeft = obj.lastIndexOf("is");
Search from right to left
_______ methods returns a new string after modifying the existing string
data type
Object is _______ in js
upper, this is called pascal casing
Data types in js begin with _______ case letter
An HTML element in the DOM>
pascal casing
instance of a class
this variable refers to an _______
Object literal notation
var person =
Why should we use objects
to logically organize complex data
Create an array
var myArray = new Array(11, "hello", true);
var myArrayLength = myArray.length;
Find size of an array
insert an item in an array
Concatenate an array
var array1 = ["apple","ball", "cat"],
var array1 = ["apple","ball", "cat"],
Separate each element of an array using comma
reverses the items in an array
The sort() method sorts the elements of an array in place and returns the array. The sort is not necessarily stable. The default sort order is according to string Unicode code points.
At the top of the hierarchy of objects we have _______ object
Immediately invoked function
_______ prevents code collison, if you are using third party plugins/js code this is very useful.
location is property of window object
window.location = "
take user to github.com if a user clicks on yes button
getElementsByTagName("p"); returns _______ . This is old.
Nodelist, it does not return an array
var pElement = document.querySelectoraAll("div p")
find all p tags inside div
html document
createElement only create an element, it does not add it to a _______
var el = document.createElement("p");
add p element to the end of body tag
setTimeout(dosomething, 2000);
Delay the execution of a function by 2 seconds
document.write("Hello World!")
Display something using javascript
<script language="javascript" type="text/javascript">
Save our code from the browser that does not support javascript
To show content to those browsers with JS turned off, the _______ tag is used
function welcome()
When a user clicks on a button display message. Create a function in javascript.
6 Javascript data types:
Numbers eg. 123, 120.50 etc.
One weird thing about javascript
javascript does not separate integer value and floating point value. All numerical values are floating point values in javascript
Reserved keyword that cannot be used for naming variables
an equal sign (=)
_______ is used to assign values to variables
Convert to integer /casting
var input = parseInt(5);
Conditional operator ? : is also called _______ operator.
_______ operator can be used to find the type of a data.
navigator is _______
web browser's object
List of events
when A page loads
HTML Button to print
the capability to store related information, whether data or methods, together in an object
the capability to store one object inside of another object
the capability of a class to rely upon another class (or number of classes) for some of its properties and methods
the capability to write one function or method that works in a variety of different ways
<button type="button" onclick="question()">Print</button>
Get title of your html document
What does case sensitivity mean?
Uppercase and lowercase characters are not the same.
var Name = "John";
How to declare a variable?
How to declare an array?
var Array = ["John", 24, true];
/* ... */ [multi-line]
How to write comments in JavaScript?
Is equal to
... == ... [without the type]
Is not equal to
... != ... [without the type]
<script src="js/my_script.js"></script>
How to link your script to HTML?
An application generally created as a relatively small object, usually small and targeted in scope and purpose, that can run online and on computers, handhelds, and cell phones.
Cascading Style Sheets (CSS)
An HTML enhancement that describes how Web pages should look. Used to efficiently bring unity and similar styles to Web pages.
HTML page
An HTML page, or HTML document, is any document created in HTML that can be displayed on the World Wide Web.
Hypertext Markup Language (HTML)
Tags created within Web documents that give instructions to a Web browser. These instructions determine the look and feel of a Web document on the Internet.
The first Web browser that allowed pictures and sound to accompany text on a Web page. Mosaic was created in 1992 at the University of Illinois.
Netscape Navigator
One of two major Web browsers used on the Internet today. Navigator, created in 1994, added to the powerful features of Mosaic, allowing additional features like animated graphics into a Web document.
Welcome page
An introduction page when you visit a Web site. A welcome page often includes the Web page owners? e-mail address and name.
prompt("Text Here");
What is the command to display a prompt?
var stringVar = prompt("Text Here");
How do you assign the value from a prompt to a string?
Using a parse. Example : var intVar = parseInt(prompt("Text Here"));
How do you assign the value from a prompt to a non-string variable?
alert("Alert Text Here");
How do you display an alert?
isNaN(varHere); //Returns true or false.
How do you test that a variable contains a valid number?
confirm("Message Text Here");
How do you display a confirmation?
True or false
What values can confirm() return?
var answerVar = confirm("Message Text Here");
How do you assign the return value of confirm() to a variable?
How do you access a page element by id?
window.onload = function() {//actions here}
How do you assign actions to the window onLoad event?