Javascript & Jquery

Ace your homework & exams now with Quizwiz!

What is a Boolean data type?

true or false.

How do you declare an inline array in JavaScript?

var cars = new Array('BMW', 'Audi', 'Chevy');

Arrays have a property called length. Length keeps track of how many items are in the array. Declare a variable named numRooms, how would you write a statement that checks the length of an array named rooms.

var numRooms = rooms.length;

Declare a variable named response.

var response;

What is the shorthand way to use weight, as the variable, and assign the value of pounds multiplied by quantity?

var weight = pounds * quantity;

var street = new Array('Columbus', 'Grove', 'Miles'); What is the index number of 'Grove'?

1

document.write('Hello World!'); 1-Explain which part is the statement is the object, 2-which part is the member operator, 3-which part is the method and 4-which part is the parameter.

1-document is the object which refers to the entire web page and all browsers implement. 2-The period is the member operator and is used to access the members of an object. 3-write() is the method of the document object and it allows something to be written in the script at the location the script is at in the html document. 4-Inside the method, the 'Hello World!' is the parameter of the method write.

What is a script?

A series of instructions a computer understands and follows step by step to achieve a goal.

What is a statement? What should a statement end with?

A statement is an instruction or step the computer takes to reach a goal. Each statement should end with a semi-colon.

What special tools do you need for html, css and javascript?

A text editor is all you need to create the files for each of the programming languages and a browser to run the files.

What is it called when an array is created by using the keyword new followed by Array();?

An array constructor

What is an array?

An array is a special type of variable that can hold many values.

What is used to keep track of arrays?

An array is automatically given a number, this is called an index.

What is creating an array, after the variable has been created called?

An array literal

Where in an html file does a javascript need to be declared?

Any place including the <head></head>. Best practices suggest at the end of the <body> tags if possible, as other code is run and the outcome is more likely to be what you want.

What type naming convention should be used in Javascript?

Camel Case is the most widely used and accepted form of naming convention. Names should be chosen that help clarify the procedure. Example getDate()

What layer is css considered?

The presentation layer, enhances the html page with rules that state how the html page is presented.

Why are comments used in coding? List 3 reasons.

Comments help clarify lines of code that may be hard to understand. Comments help other programmers follow along with the code. Comments help remind programmers of future upgrades or additional code. Comments can be used to rely license requirements to others using the software.

How do you link external css and javavascript files, inside an html file?

Css, is <link rel="stylesheet" type="text/css" href="?.css">. Javascript, is <script src="?.js"></script>.

What 3 steps need to occur when writing a script?

Define the goal, Design the script, Code each step.

What is escaping a character and why is it used?

Escaping is when you need to use a character that is normally seen as a special key. For example if you wanted to use "isn't" in a string, the comma would through an exception error. Instead you would escape the quote by using the backwards slash key like this "isn\'t".

What do web browsers use to create a model of the web page?

HTML Markup.

Is var old-flower = true;

No, A dash is not allowed when naming a variable, proper coding ethics dictate you should use camel case programming. Example var oldFlower = true; is the preferred method.

Should Html, Css and Javascript code reside in the same file?

No, Html should reside in a file ending in .html. CSS, should reside in a file ending in .css. Javascript, should reside in a file ending in .js.

Is var flower = true; and var Flower = true; the same?

No, JavaScript is case sensitive and sees both as different, using variables with the same name is not encouraged.

Do humans and computers approach tasks the same way?

No, computers approach tasks programmatically.

Should the files created in HTML, CSS and Javascript all reside in the same folder?

No, for the sake of staying organized, you should keep the files in their perspective folders. Js files in either a js, javascript or script directory. While css files reside in a css folder.

What is a Numeric data type?

Numeric data types consist of numbers and are not enclosed in quotes.

Assign 3 to the response variable.

response = 10;

Content layer, presentation layer, behavior layer form which approach to building web pages?

Progressive Enhancement.

Which 3 things make up a models use of objects?

Properties, that tell us about the object. Methods, that perform tasks using the properties of the object. Events, that trigger when a user interacts with the computer.

How do you create a one line comment? How do you create a multi-line comment?

Single line comment requires //. Multi-line comments or block comments, require /* comment-here */

What is a String data type?

Strings consist of letters and other characters and are enclosed in either single or double quotes but they must remain the same on both sides of the string.

What layer is javascript considered

The behavior layer, can change how the page behaves and can add interactivity.

What does the code you write access, that makes the page interactive?

The browsers model of the web page.

What layer is html considered?

The content layer, it gives the web page structure and adds semantics.

What do objects represent?

Things in the real world.

Is JavaScript case sensitive?

Yes "getDate" "Getdate" are both different in JavaScript.

Can you declare both a string and an integer value to a variable?

Yes, in JavaScript you can assign the value of different data types to a variable on the same line.

Can you change the value of variable once the value has been set?

Yes, once a variable has been set you call the variable by simply writing the variable name and make it equal to something else.

Is $times an acceptable name for a variable?

Yes, variables can begin with a letter, dollar sign or an underscore. It can not start with a number.

When trouble shooting problems with javascript, css or html files what are the keystrokes in Chrome to open the javascript console?

ctrl-shift j

How do you declare a array when the variable has been declared? Use var flowers;

flowers = ['Rose', 'Sunflower', 'Lilly'];

How do you store a Boolean value to a variable?

flowers = true;


Related study sets

Ohio Life Insurance - Federal Tax Considerations for Life Insurance and Annuities

View Set

Prelude: And Just What is Geology?

View Set

BUS 241 Ch 15 Substantial Performance

View Set

Google Analytics Assessment Three

View Set