True Basics Flashcards

1
Q

How do you do one line comments in javascript ?

A
// enter comment here
// enter comment2 here
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How do you do multi-line comments in javascript?

A
/* comment
blah blah blah
*/ this line ends the comment
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you assign a value to a string variable?

A

var name = “george” ;

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

What does initializing a variable mean

A

assigning an initial value to a variable.

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

What date type does a variable value have if you do not assign a value?

A

undefined

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

Are variables case sensitive in javascript?

A

yes

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

Write three words together as one word to show you understand what camel case is.

A

helloMyFriend

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

What data type is the value 5 in javascript?

A

number

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

_____is a data type in javascript which represents numeric data

A

number

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

How do you add two numeric values in Javascript

A

5 + 5

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

How do you subtract two numeric values in javascript

A

7 - 3

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

How do you multiply two numeric values in javascript

A

7 * 3

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

How do you divide two numeric values in javascript

A

9 / 3

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

How do you increment the number of a variable in javascript (suppose i is the variable)

A

i++

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

How do you decrement the number of a variable in javascript (suppose i is the variable)

A

i–

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

What data type stores decimal numbers?

A

floating point

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

What is the operator for remainder

A

%

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

What what does the remainder operator return

A

The remainder that’s left over after division

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

Rewrite myVar = myVar + 5 into a compound assignment

A

myVar += 5

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

Rewrite myVar = myVar - 5 into a compound assignment

A

myVar -= 5

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

Rewrite myVar = myVar * 5 into a compound assignment

A

myVar *= 5

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

What does escaping a quote mean?

A

When you use the backslash from within quotations to include the same quotation character as a part of it.

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

How do you escape the “ character

A

"

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

How do you escape the ‘ character

A

'

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
how do you escape a backslash
\\
26
how do you escape a new line?
\n
27
how do you escape a carriage return?
\r
28
how do you escape a tab?
\t
29
how do you escape a word boundary?
\b
30
how do you escape a form feed?
\f
31
How do you concatenate two string fields together?
"string content 1" + "string content 2"
32
How do you concatenate two strings together (through a variable) using the same sequence that represents incrementing a number?
``` var ourStr = "I come first. "; ourStr += "I come second."; ```
33
How do you find the length of the value of a variable Assume variable is called variableName
variableName.length
34
How do you find the first character of a string variable Assume variable is called variableName
variableName[0]
35
How do you find the second character of a string variable Assume variable is called variableName
variableName[1]
36
How do you find the third character of a string variable Assume variable is called variableName
variableName[2]
37
How do you find the last character in a string variable? Assume variable is called variableName
variableName[variableName.length -1]
38
How do you find the second last character in a string variable? Assume variable is called variableName
variableName[variableName.length -2]
39
_______ are the classifications we give to the different kinds of data that we use in programming.
data types
40
In JavaScript, there are _____ fundamental data types:
seven
41
What is the data type for Any number, including numbers with decimals: 4, 8, 1516, 23.42
number
42
What is the data type for any grouping of characters on your keyboard (letters, numbers, spaces, symbols, etc.) surrounded by single quotes: ' ... ' or double quotes " ... ". Though we prefer single quotes.
string
43
This data type only has two possible values— either true or false (without quotes).
boolean
44
This data type represents the intentional absence of a value, and is represented by the keyword ____ (without quotes).
null
45
This data type is denoted by the keyword ____(without quotes). It also represents the absence of a value though it has a different use than null.
undefined
46
A newer feature to the language, ______ are unique identifiers, useful in more complex coding. No need to worry about these for now.
symbols
47
What are objects?
Object: Collections of related data.
48
Operators aren’t just for numbers! When a + operator is used on two strings, it _____ the right string to the left string
appends
49
This process of appending one string to another is called
concatenation
50
Every string has a property called _____ that stores the number of characters in that string.
length
51
What are methods?
Actions we can perform in javascript.
52
To use a method on a string how do we call the method?
by appending an instance with a period (the dot operator), the name of the method, and opening and closing parentheses: e.g. 'example string'.methodName().
53
When we use console.log() we’re calling the ___method on the ____ object
log method | console object
54
When we use console.log() we’re calling the log method on the ____ object
console
55
When we use console.log() we’re calling the ____method on the console object
log
56
write a console.log statement that would convert what would be the output "dead tree" to upper case.
console.log('dead tree'.toUpperCase());
57
write a console.log statement that would remove the whitespace in string ' Remove whitespace '
console.log(' Remove whitespace '.trim());
58
Write a console.log statement that would return a random floating point number between 0 and 100.
console.log(Math.random() * 100);
59
What method takes a decimal number, and rounds down to the nearest whole number.
Math.floor()
60
How would you ensure a whole number output that generates a random number between 0 and 100 using a console.log statement
console.log(Math.floor(Math.random() * 100));
61
Find a method on the JavaScript Math object that returns the smallest integer greater than or equal to a decimal number. Use this method with the number 43.8. Log the answer to the console.
console.log(Math.ceil(43.8)) ;
62
The ______ method is used to log or print messages to the console. It can also be used to print objects and other info.
console.log()
63
______is a programming language that powers the dynamic behavior on most websites. Alongside HTML and CSS, it is a core technology that makes the web run.
Javascript
64
JavaScript is a programming language that powers the dynamic behavior on most websites. Alongside ____ and CSS, it is a core technology that makes the web run.
html
65
JavaScript is a programming language that powers the dynamic behavior on most websites. Alongside HTML and ___, it is a core technology that makes the web run.
css
66
_____return information about an object, and are called by appending an instance with a period ., the ____ name, and parentheses.
methods
67
_______ contain methods that can be called by appending the library name with a period ., the method name, and a set of parentheses.
libraries
68
Numbers _____ are a primitive data type. They include the set of all integers and floating point ______.
number
69
The _____ property of a string returns the number of characters that make up the string.
.length
70
When a new piece of data is introduced into a JavaScript program, the program keeps track of it in _______ of that data type.
an instance
71
An instance is an individual case of a _____
data type
72
An ____ is an individual case of a data type.
instance
73
______ are a primitive data type. They can be either true or false.
booleans
74
The ______ function returns a floating-point, random number in the range from 0 (inclusive) up to but not including 1.
Math.random()
75
The _____ function returns the largest integer less than or equal to the given number.
Math.floor()
76
In JavaScript, single-line comments are created with
two consecutive forward slashes //.
77
____ is a primitive data type. It represents the intentional absence of value. In code, it is represented as ____
null
78
______ are a primitive data type. They are any grouping of characters (letters, spaces, numbers, or symbols) surrounded by single quotes ' or double quotes "
strings
79
Arithmetic Operators - what is the operator for addition
+
80
Arithmetic Operators - what is the operator for subtraction
-
81
Arithmetic Operators - what is the operator for multiplication
*
82
Arithmetic Operators - what is the operator for division
/
83
In JavaScript, multi-line comments are created by surrounding the lines with __ at the beginning and __ at the end. Comments are good ways for a variety of reasons like explaining a code block or indicating some hints, etc.
``` /* at beginning */ at end ```
84
An assignment operator assigns a value to its left operand based on the value of its right operand. Write number = number + 10 in a way that demonstrates the additional assignment
number += 10
85
An assignment operator assigns a value to its left operand based on the value of its right operand. Write number = number - 7 in a way that demonstrates the subtraction assignment
number -= 7
86
An assignment operator assigns a value to its left operand based on the value of its right operand. Write number = number * 3 in a way that demonstrates the multiplication assignment
number *= 3
87
An assignment operator assigns a value to its left operand based on the value of its right operand. Write number = number / 10 in a way that demonstrates the division assignment
number /= 10
88
_____ is a primitive JavaScript value that represents lack of defined value. Variables that are declared but not initialized to a value will have the value.
undefined
89
What is the way to declare a variable in pre-ES6 versions of javascript
var = value
90
What is the preferred way to declare a variable in javascript post-ES6 if the value can be reassigned later
let = value
91
What is the preferred way to declare a variable in javascript post-ES6 if the value should remain constant
const = value
92
Template literals are strings that allow embedded expressions, ${expression}. While regular strings use single ' or double " quotes, template literals use backticks instead. Embed the variable name into a console.log expression saying hello to the users
console.log (`Hello, ${name}`)
93
____ hold reusable data in a program and associate it with a name.
variables
94
Variables are stored in ___
memory
95
The var keyword is used in ____ versions of JS.
pre-ES6
96
____is the preferred way to declare a variable when it can be reassigned
let
97
____is the preferred way to declare a variable with a constant value
const
98
Variables that have not been initialized store the primitive data type _____
undefined
99
The __operator is used to concatenate strings including string values held in variables
+
100
The + operator is used to _____ strings including string values held in variables
concatenate
101
In ES6, template literals use backticks ` and ____to interpolate values into a string.
${}
102
In ES6, ______ use backticks ` and ____to interpolate values into a string.
template literals