Use LEFT and RIGHT arrow keys to navigate between flashcards;
Use UP and DOWN arrow keys to flip the card;
H to show hint;
A reads text to speech;
50 Cards in this Set
- Front
- Back
What are the different data types in Javascript? |
There's -Numbers -Strings -Booleans -Objects -null -undefined Note that there isn't a separate Integer, just number - which is represented as a double precision floating point number. There's also -Functions -Arrays -RegExps all of which are Objects deep down, but with enough special wiring to be mentioned on their own. |
|
What is the difference between an Ajax call and a form submit? |
A standard form submit sends a new HTTP request (POST or GET) and loads the new page in the browser. In Ajax, the data is sent to the server (POST or GET) in the background, without affecting the page at all, and the response is then received by javascript in the background, again without affecting the page at all. (The javascript can, of course, then use the data received from the server to update some of the page content.) Ajax is generally useful where only a small section of the page content will change. |
|
What does Ajax mean? |
Asynchronous JavaScript and XML |
|
What is the object you use to make an Ajax call? |
The XMLHttpRequest object is used to exchange data with a server. |
|
What is the object you have to use to make an Ajax call in IE earlier versions? |
IE5 and IE6 use an ActiveXObject variable=new ActiveXObject("Microsoft.XMLHTTP"); |
|
List the methods of the object you use to make Ajax calls |
To send a request to a server, we use the open() and send() methods of the XMLHttpRequest object: xmlhttp.open("GET","ajax_info.txt",true); xmlhttp.send(); |
|
Which event listener do you use in Ajax calls? |
The onreadystatechange event When a request to a server is sent, we want to perform some actions based on the response. The onreadystatechange event is triggered every time the readyState changes. The readyState property holds the status of the XMLHttpRequest. |
|
How many different values can the readyState property have? |
0: request not initialized 1: server connection established 2: request received 3: processing request 4: request finished and response is ready |
|
What is JSON? |
JavaScript Object Notation |
|
What is the main difference between JSON and the Javascript object literal formats? |
JSON has a much more limited syntax including: Key values must be quoted Strings must be quoted with " and not ' You have a more limited range of values (e.g. no functions allowed) |
|
What is event delegation and what are the two main reasons why it is used? |
JavaScript event delegation is a simple technique by which you add a single event handler to a parent element in order to avoid having to add event handlers to multiple child elements. 1:There are less event handlers to setup and reside in memory. This is the big one; better performance and less crashing. 2:There’s no need to re-attach handlers after a DOM update. If your page content is generated dynamically, via Ajax for example, you don’t need to add and remove event handlers as elements are loaded or unloaded. |
|
How do you find out the tag name (for example ‘p’ or ‘a’ or ‘div’) of a dom element with Javascript? |
var x = document.getElementById("myP").tagName; |
|
If you have a click event, how do you find out from the event object which element was clicked? |
The srcElement property returns the element that fired the event. This is an object, and has the same properties as the element. |
|
Which dom elements have innerHTML (give 3 examples), which dom elements have value? |
p, div, a |
|
How do you get the first element of an array? |
return array[0]; |
|
How can you find out how many elements you have in an array? |
return array.length |
|
What are the index numbers in an array? |
[0,1,2,3,4,5] they are the numbers of the items in an array |
|
How do you add new elements to an array (to the end of the array)? |
var fruits = ["Banana", "Orange", "Apple", "Mango"]; |
|
How do you add a single line comment and a multi line comment to your Javascript code? |
// |
|
How do you find out how long a string is? |
console.log("string".length); |
|
How can you cut out the first 3 characters of a string? |
Just use substring: "apple".substring(0,3); will return app |
|
What is the event object? |
During normal program execution, a large number of events occur, so the event object is a fairly active object, constantly changing its properties.Whenever an event fires, the computer places appropriate data about the event into the event object - for example, where the mouse pointer was on the screen at the time of the event, which mouse buttons were being pressed at the time of the event, and other useful information. |
|
How can you access the event object in most browsers? |
You can just use, event.srcElement.id or event.srcElement.tagName in most browsers |
|
How can you access the event object in Internet explorer? |
You have to use addEventListener("click", funtion()) |
|
How do you add an event listener to a DOM element? |
addEventListener() |
|
What data structure do you get if you use the getElementsByClassName or getElementsByTagNamemethod? |
You get an HTML collection |
|
What is the innerHTML of a DOM element? |
This property provides a simple way to completely replace the contents of an element. For example, the entire contents of the document body can be deleted by: |
|
How do you change the innerHTML of a DOM element with Javascript? |
document.getElementById("myFakeId").innerHTML = "a string of strings"; |
|
How do you change the styling of a DOM element with Javascript (for example the display property’svalue)? |
document.getElementById("button").style.display="inline-block"; |
|
What is the window.onload event, why do we use it? |
window.onload |
|
What happens when you call event.preventDefault()? |
e.preventDefault() will prevent the default event from occuring |
|
What is an API? (with your own words) |
An API, at its most basic, is a way for outside (or third-party) applications to interact with your (or another company's) application. |
|
What does OOP mean? (with your own words) |
Object-oriented programming (OOP) is a programming language model organized around objects rather than "actions" and data rather than logic. Historically, a program has been viewed as a logical procedure that takes input data, processes it, and produces output data. |
|
What is a keyword in programming? (with your own words) |
Keywords can be commands or parameters. Every programminglanguage has a set of keywords that cannot be used as variable names.Keywords are sometimes called reserved names |
|
List 20 Javascript Keywords |
All Javascript Reserved Words |
|
What is the Window object in Javascript? (with your own words) |
The window object is supported by all browsers. It represents the browser's window. |
|
What is the DOM? (with your own words) |
The Document Object Model (DOM) is an application programming interface (API) for valid HTML and well-formed XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated. |
|
What is the DOM Node? (with your own words) |
At the top level, there is an html node, with two children: head and body, among which only head has a child tag title. |
|
What is the DOM Tree? (with your own words) |
It is the hierarchy of parent and child dom nodes. |
|
What are the 3 ways to include Javascript on an HTML page? |
1. You can include it as an external file, inside of a script tag |
|
What keyword do you use to create a variable in javascript? |
var |
|
What are data types in Javascript? |
There's |
|
Create a Javascript array? (using shorthand!) |
var myArray = [3, 2, 1, "bob", "joe"]; |
|
Create a Javascript object? (using shorthand!) |
var car = {type:"Fiat", model:500, color:"white"}; |
|
Create a Javascript function? |
var myFunk = function(){ |
|
What is a parameter in Javascript? |
Inside of the parentheses of a function, you can place arguments or parameters which you can call within your function. |
|
What is a argument in Javascript? |
technically a and b here "var myFunk = function(a, b){" are considered parameters |
|
What does the return keyword do within a function in Javascript? |
var a = function(){ |
|
What are the 3 most common way in Javascript to find an HTML element on the page? |
1. document.getElementById |
|
How can you access properties in a Javascript object literal? |
objectName.propertyName |