JavaScript 1.1 Flashcards
Define Javascript
“An object-oriented computer programming language commonly used to create interactive effects within web browsers.” -Oxford
What’s the difference between an interpreted language vs a compiled language?
In a compiled language, the target machine directly translates the program. In an interpreted language, the source code is not directly translated by the target machine. Instead, a different program, aka the interpreter, reads and executes the code.
Define object-oriented programming
Object-oriented programming is a model that organizes software design around data or objects rather than function or logic
Define using variables
Variables are used as containers for storing data (values)
Define API
An application programming interface is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software.
What can we use to add special characters within strings?
\ the escape character
Boolean has two values :
true or false
What happens when you place an increment after a given value?
It returns the original value and then the increment. Placing it before will just give us the incremented value.
What does var x += y mean?
x = x + y
Explain what these three are and what they mean! ‘ &&, II, and !’
These are logical operators; && returns true if both ops are true, II returns true if one op is true and ! returns true if the op is false and vice versa
A Javascript function is:
a block of javascript code, that can be executed when “called” for
Create external script that would be placed in a HTML document
script tag, add the source attribute, and then call for js file
In what situations do we use the document.write() function
For testing only, all other existing html gets deleted
Javascript programming is a list of:
“statements”
When it comes to variables, if you want your code to run on old browsers you must use:
“var” keyword
A variable used for values that don’t change
“const” variable
If you think the variable can change use:
“let” keyword
List 2 facts about identifiers
Reserved Javascript words cannot be used to declare variables. Underscores and the money character can be used at the beginning of an identifier.
Variables defined with let have blockscope which means?
variables declared with in a block cannot be accessed outside of {}
“let” and “const” variables cannot be redeclared TRUE OR FALSE
TRUE
“var” and “const”variables cannot be redeclared TRUE OR FALSE
FALSE
What’s a better way to redeclare a variable using “let”?
let x = 10; {let x = 2;} //x will still have the value of 10
“const” variables can be reassigned TRUE OR FALSE
FALSE
Name three popular data types in JavaScript
Strings, Objects, Numbers
What will 16 + “Volvo” return in a js expression?
16Volvo (JavaScript converts numbers into strings in JS arithmetic)
Array indexes are zero-based which means:
The first item is an array starts at 0, the second would be one, and so on…
Describe the content that goes within an JS Object
JS Objects are written in curly {}, the properties are written in name:value pairs
A variable without a value has the value of:
Undefined
(Js Objects) a method is a
Function stored as a property
The JavaScript “this”:
keyword refers to the object it belongs to.
declare a Object method
objectName.methodName()