IT 612

Ace your homework & exams now with Quizwiz!

how do you access an element in an array?

with the index you wish to access inside the brackets alert ( greetings[0] );

can variables be overwritten?

yes

do template strings honor whitespace?

yes

are variables in javascript dynamically typed?

yes, meaning a variable can be an integer, and then later a string, then later an object, if so desired

are there predefined javascript objects?

yes, you can also define your own kind of objects

what is a JavaScript array?

"dynamic" entities that can change size after they are created

How do you concatenate in ES6?

Console.log(`Hello my name is ${firsName} ${lastName}. My age is ${age}.`);

what is an array?

Data structures consisting of related data items

Javascript Timeline 2003

ES4 abandoned (class, module, destructuring etc.)

Javascript Timeline 2009

ES5 (JSON, object methods, functional arrays etc.)

Javascript Timeline 2015

ES6 significant improvement(let, const, class, import, export etc.)

what is the DOM document object?

the root JavaScript object representing the entire HTML document

Javascript Timeline 1997

Standardized by ECMA

onload event

The most important event tells us an object is loaded and therefore ready to work with

what are the disadvantages of client-side scripting?

There is no guarantee that the client has JavaScript enabled What works in one browser, may generate an error in another web applications can be complicated to debug and maintain

how do you reduce validation errors?

Using pop-up JavaScript alert Provide textual hints to the user on the form itself Using tool tips to display context-sensitive help about the input a JavaScript-based mask

what does the cancelable property do?

a Boolean value that indicates whether or not the event can be cancelled

In the DOM, what is each element within the HTML document called?

a node

What is java script today like with node.js?

a real software language that's used to build full-stack applications

whats a constant?

a variable that cannot be overwritten Once declared, you cannot change its value

how do you find the length of a string in javascript?

alert (greet.length);

what does the math class do?

allows one to access common mathematic functions and common values quickly in one place

objects can also have methods, what are they?

are functions associated with an instance of an object

frame events

are the events related to the browser frame that contains your web page

what are some useful objects in javascript?

array, boolean, date, math, string

when can assignment happen?

at declaration-time by appending the value to the declaration, or at run time with a simple right-to-left assignment

how can many user input errors be eliminated?

by choosing a better data entry type than the standard

how are functions defined in javascript?

by using the reserved word function and then the function name and (optional) parameters

how do you access a single string charecter?

charAt()

what function shows a message on the console?

console.log("Message");

what can objects have associated with them?

constructors, properties, and methods

how do you display todays date as a string?

create a new object and use the toString() method var d = new Date();

==

equals (x==9) is true (x=="9") is true

===

exactly equals, including type (x==="9") is false (x===9) is true

Javascript Timeline 1996

first edition named Mocha/Live Script by Brendan Eich

when was react released?

in 1995 by Netscape, JavaScript has gone through many changes

what is a javascript event?

is an action that can be detected by JavaScript.

what does the bubble property do?

is set to true then there must be an event handler in place to handle the event or it will bubble up to its parent and trigger an event handler there

What is the DOM?

is the objects that make up a web page

<=, >=

les than or equal, greater than or equal (x<=9) is true

<,>

less than, greater than (x<5) is false

how do you declare variables with Es6?

let myName = "Ashley"; const myLastName = "Martin"; myLastName = "Smith" GIVES AN ERROR

what does the alert() function do?

makes the browser show a pop-up to the user, with whatever is passed being the message displayed

what methods does the math class contain?

max(), min(), pow(), sqrt(), and exp(), and trigonometric functions such as sin(), cos(), and arctan()

what are the event types?

mouse events keyboard events form events frame events

is java and javascript the same?

no java script and java are vastly different languages with different uses

are semi colons required?

no, but are permitted

are null and undefined the same states for a variable?

no, they are two distinctly different states

!=

not equal (4!=x) is true

!==

not equal in either value or type (x!=="0") is true (x!==9) is false

what are the advantages of client-side scripting?

process is on client not server, reducing load on server browser responds faster to user events can interact with html in a way the server cant

what is the scope of the let keyword?

protects the value of the global variable The value of the let variable is not reset outside of the if/else block

what does a template string do?

provide us with an alternative to string concatenation They also allow us to insert variables into a string Any JavaScript that returns a value can be added to a template string between the ${ } in a template string

types of input validation

required information correct data type correct format comparison range check custon

do functions require a return or parameter type?

since Javascript is dynamically typed, no

what does === mean?

tests not only for equality but type equivalence

how do you remove an item from the back of an array?

the pop method

what do you use to add an item to an existing array?

the push method greetings.push("Good Evening");

how does javascript interact with the HTML document?

through a programming interface (API) called the Document Object Model

what is the document.write() method used for?

to create output to the HTML page from JavaScript

how do you create a new object?

use the new keyword, the class name, and ( ) brackets with n optional parameters inside, comma delimited var someObject = new ObjectName(p1,p2,..., pn);

how can object properties be accessed?

using dot notation where a dot between the instance name and the property references that property alert(someObject.property);

how are methods called?

using the same dot notation as for properties, but instead of accessing a variable, we are calling a method someObject.doSomething();

how do you initialize an array with values?

var greetings = new Array("Good Morning", "Good Afternoon");

what code creates a new, empty array?

var greetings = new Array();


Related study sets

Chapter 6 - The Survey Interview

View Set

Morphology 3, Group 5: Confident

View Set

Starting Out With JAVA From Control Structures Through Objects 7th Edition Chapter 4: Loops and Files Practice Questions

View Set