-
[Javascript] What is Javascript?
Javascript is a high-level, dynamic, untyped and interpred programming language. It has been standardized in the ECMAScript languange specification. Alongside HTML and CSS, it is one of the three essential technologies of World Wide Web content production.
-
[Javascript] What are the three ways to add JavaScript commands to Web Pages:
- -Embedding code
- -Inline code
- -External file
-
[Javascript] The Event Handler Command is used to __?__
specify actions in response to an event.
-
[Javascript] Event Handler: onload:
occurs when a page loads in a browser.
-
[Javascript] Event Handler: onload example:
- When the page loads to the browser, the iframe element uses the onload command to load the the text into the paragraph element of id = demo:
-
[Javascript] Event Handler: onload is commenly used for what?
the onload event is commonly used to trigger a function or execute code when an object, such as an image or a webpage, has finished loading.
-
[Javascript] Event Handler: onunload:
used to trigger a function or execute code when a webpage is about to be unloaded or when the user navigates away from the current page.
-
[Javascript] Event Handler: onunload example:
- the onunload in this example prints a popup alert box when the user leaves the page:
-
[Javascript] Equality: What is the difference between == and === ?
JavaScript has both strict and type–converting comparisons:
-Strict comparison (e.g., ===) checks for value equality without allowing coercion.
-Abstract comparison (e.g. ==) checks for value equality with coercion allowed.
-
[Javascript] What is the object type?
- The object type refers to a compound value where you can set properties (named locations) that each holds their own values of any type.
- EXAMPLE:
-
-
[Javascript] Explain Scope in JavaScript?
In JavaScript, each function gets its own scope. The scope is basically a collection of variables as well as the rules for how those variables are accessed by name. Only code inside that function can access that function's scoped variables.
-
[Javascript] Explain what a callback function is and provide a simple example.
- A callback function is a function that is passed to another function as an argument and is executed after some operation has been completed. Below is an example of a simple callback function that logs to the console after some operations have been completed.
- EXAMPLE:
-
[Javascript] Given a string, reverse each word in the sentence (hint: split, reverse and join)
-
[Javascript] Explain the concept of equality (==, ===)
JavaScript has both strict and type-converting comparisons.
- a) Strict comparison (e.g, === ) checks for value equality without allowing coercion.
- b) Abstract comparison (e.g. ==) checks for value equality with coercion allowed.
-
[Javascript] Javascript has both _?_ and _?_ comparisons.
Javascript has both strict ( ===) and abstract (or type converting) (==) comparisons.
-
[Javascript] If either value (side, opperand etc.) in a comparison could either be a true or false value avoid the _?_ and use _?_.
If either value (side, opperand etc.) in a comparison could either be a true or false value avoid the == and use === strict.
-
[Javascript] If either value in a comparison could be of these specific values: (0, "", or [] -- an empty array) avoid _?_ and use _?_.
If either value in a comparison could be of these specific values: (0, "", or [] -- an empty array) avoid == and use ===.
-
[Javascript] [Type coersion] In JavaScript, coercion refers to the _?_ or _?_conversion of values from one data type to another. _?_
In JavaScript, coercion refers to the automatic or implicit conversion of values from one data type to another
-
[Javascript] [Type coersion] Given:
const value1 = "5";
const value2 = 9;
let sum = value1 + value2;
What is the value of sum?
sum is equal to "59" a string.
-
[Javascript] [variable declarations] True/ False: var is block scoped.
FALSE: (var) variable is function-scoped. This means that a var declared inside a function is accessible throughout the entire function, but not outside of it.
-
[Javascript] [variable declarations] What variable key words are "block scoped"?
let or const. If you want block-scoped variables, you should use let or const instead. These are limited to the block in which they are defined.
-
[Javascript] [variable declarations] What variable key words are "block scoped"?
-
[Javascript] [variable declarations] Given the following code:
function foo( str ){
return str +" bah.";
}
var height = 10;
when would the height variable be declared?
The variable height is declared using var outside of any function or block scope. This means height is declared at the global scope and will be available throughout the entire script.
|
|