JavaScript

Ace your homework & exams now with Quizwiz!

Murphy's Law states that anything that can go wrong

will go wrong!

There are several types of looping structures in Javascript.These include (select all that apply) for loop while loop do ... while loop for ... each loop if ... then loop

for loop while loop do ... while loop

This method confirms patterns, returning the text of the matches in an array.

match()

This method returns the character position of the first pattern matching the one given as a parameter.

search()

What is a variable?

Temporary data storage that can be altered, or varied.

How would you format a comment in JavaScript to leave author notes or assist in troubleshooting your code?

/* commented text*/ , // commented text

Which of the following is NOT a comparison operator? < >= = == !=

=

What is JavaScript?

A computer language used predominantly by browsers

What tools do you need to create web applications in JavaScript?

A text editor, A Browser

What is an array?

A variable that can hold more than one value.

This is a common mistake that everyone makes while programming at some point in their careers. (select all that apply) Case Sensitivity Using = instead of == Missing + signs in concatenation Using a method as a property Using a property as a method Mismatching parentheses or braces Undefined variables or functions

All are correct

The result of the following code block will be: var roomTemprature = 30; if (roomTemperature > 30) { roomTemperature = roomTemperature - 10; alert("Air conditioning switched to cool"); } else {alert("Air conditioning off");}

An error will appear in the JavaScript console

Comparisons can be made to control program flow with what type of JavaScript statement(s)?

Conditionals

Where do you put the JavaScript so that it will execute properly in your documents?

Linked as an external file with a .js extension. , at the end of the body section of the HTML document, In the head section of the HTML document, In a "script block" within the HTML

The alert() function is a method to give user feedback. What does the command do when executed?

Pops up a dialog box in the browser with text information and an "OK" button.

What is a common way to debug your code? (select all that apply) Setting Breakpoints Adding "watches" on variables Outputting values to the console with console.log commenting out code Using "debug mode" in Microsoft Visual Studio Code.

Setting Breakpoints Adding "watches" on variables Outputting values to the console with console.log commenting out code

data types recognized in JavaScript

Text, Numbers, Booleans

Assignment operators can store the result of a comparison operation.

True

Does myString return the array ["407-823-4674"]? var myString = "407-823-4674";var myRegExp = /\d\d\d-\d{3}-[0-9]{4}/g;myString = myString.match(myRegExp);

True

Operators have an order of precedence. Arithmetic operators have a higher priority than comparison operators.

True

Some errors are not necessarily bugs in your code, but in fact exceptions to the normal circumstances that cause your code to fail.

True

You can have an if statement contained inside of an if statement.

True

A variable declaration is the creation of a new storage area in memory. It is achieved using the var keyword and

a name.

Once declared, a variable gets its type and value through the process of

declaration.

This method breaks a single string into an array of strings. You pass a string or a regular expression to the method that determines where the break occurs.

split()

Regular expressions enable you to define a pattern of characters that you want to match. Using this pattern, you can perform splits, searches, text replacement, and matches on

strings.

There is an alternative to the if...else conditional statement in JavaScript. This is the

switch statement

Logical operators can add complexity to a comparison with AND, OR, and NOT. Which of the following is true? true && true || true ; returns false true && true || false ; returns true true && false; returns false false || true || !true && false; returns true false && true && true ||false; returns true

true && true || false ; returns true true && false; returns false false || true || !true && false; returns true

A great way to check for errors is by using the following programming structure in JavaScript

try...catch


Related study sets

Econ 1710 Chapters 18,20,21 Multiple Choice Review - JACK

View Set

Chapter 34: Acute kidney injury and chronic kidney disease

View Set

JAVA OCA ‎1Z0-808 Chapter 2 - Operators and Statements

View Set

Digital Cloud Leader - Module Questions

View Set

DELEGATION, LEADERSHIP. MANAGE,ENT

View Set

Test #1 Microeconomics (ch. 3 only)

View Set

Chapter 33: Management of Patients With Nonmalignant Hematologic Disorders

View Set