JS Basics Flashcards
Define what Syntax means for programming
Syntax is the rules of a language, a programs commands, special words, and punctuation
Do statements have to have a semi colon at the end?
False, as long as there isn’t more than one statement on that line of code
You can run Javascript within a script tag that already has a source attribute that points to a external javascript file?
False
Define “var”
Declares a variable, optionally initialing it to a value
Define “let”
Declares a block-scoped, local variable, optionally initializing it to a value
Define “constant”
Declares a block-scoped, read-only named constant
Define an “identifier”
An “identifier” is a sequence of characters in the code that identifies a variable, function, or property
Identifiers must start with
a letter, underscore, or dollar sign - subsequent characters can be 0-9
What methods can either transform characters to all upper case or all lower case?
.toUpperCase() or .toLowerCase()
The process of combining two or more strings to create a bigger string.
String Concatenation
What’s the syntax for template literals?
A pair of backticks `` and ${} to add other values dynamically
What method returns the first Element within the document that matches the specified selector, or group of selectors?
document.querySelector()
Explain .innerHTML property
The element property innerHTML gets or sets the HTML or XML markup contained with the element
Define the “if…else”
An “if” statement executes a block of code if the statement is true. Otherwise if the statement is false it can execute another statement.
What is the sign for the “AND” operator and what is it used for?
&& this is used to test multiple conditions in an if statement