JavaScript 1.1 Flashcards

1
Q

Define Javascript

A

“An object-oriented computer programming language commonly used to create interactive effects within web browsers.” -Oxford

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What’s the difference between an interpreted language vs a compiled language?

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define object-oriented programming

A

Object-oriented programming is a model that organizes software design around data or objects rather than function or logic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define using variables

A

Variables are used as containers for storing data (values)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define API

A

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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What can we use to add special characters within strings?

A

\ the escape character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Boolean has two values :

A

true or false

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What happens when you place an increment after a given value?

A

It returns the original value and then the increment. Placing it before will just give us the incremented value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What does var x += y mean?

A

x = x + y

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explain what these three are and what they mean! ‘ &&, II, and !’

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

A Javascript function is:

A

a block of javascript code, that can be executed when “called” for

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Create external script that would be placed in a HTML document

A

script tag, add the source attribute, and then call for js file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In what situations do we use the document.write() function

A

For testing only, all other existing html gets deleted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Javascript programming is a list of:

A

“statements”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

When it comes to variables, if you want your code to run on old browsers you must use:

A

“var” keyword

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A variable used for values that don’t change

A

“const” variable

17
Q

If you think the variable can change use:

A

“let” keyword

18
Q

List 2 facts about identifiers

A

Reserved Javascript words cannot be used to declare variables. Underscores and the money character can be used at the beginning of an identifier.

19
Q

Variables defined with let have blockscope which means?

A

variables declared with in a block cannot be accessed outside of {}

20
Q

“let” and “const” variables cannot be redeclared TRUE OR FALSE

A

TRUE

21
Q

“var” and “const”variables cannot be redeclared TRUE OR FALSE

A

FALSE

22
Q

What’s a better way to redeclare a variable using “let”?

A

let x = 10; {let x = 2;} //x will still have the value of 10

23
Q

“const” variables can be reassigned TRUE OR FALSE

A

FALSE

24
Q

Name three popular data types in JavaScript

A

Strings, Objects, Numbers

25
Q

What will 16 + “Volvo” return in a js expression?

A

16Volvo (JavaScript converts numbers into strings in JS arithmetic)

26
Q

Array indexes are zero-based which means:

A

The first item is an array starts at 0, the second would be one, and so on…

27
Q

Describe the content that goes within an JS Object

A

JS Objects are written in curly {}, the properties are written in name:value pairs

28
Q

A variable without a value has the value of:

A

Undefined

29
Q

(Js Objects) a method is a

A

Function stored as a property

30
Q

The JavaScript “this”:

A

keyword refers to the object it belongs to.

31
Q

declare a Object method

A

objectName.methodName()