Digital Tech and Innovations Javascript Fundamentals Test Flashcards
What is the writing inside parenthesis called
An argument
How do you make a comment javascript
//___
How do you emphasize text
is this javascript or html?
<em></em> html
how do you bold something?
Is this html or java?
<b></b> html
What is a string literal
Anything in quotes
What does string in string literal mean
Series of characters, they don’t havre to make sense
What is Parenthisis and what is brackets
()
[]
What is a method
A specific tool that does something extremely specififc (eg document.write())
Everything inside partenthisis is called an ___
Argument
What is variable declaration
When you declare or write a variable
How do you declare a variable of var a
var a;
What is variable initialization
Defining a varibale
How do you do variable initilization of var a
var a = poo;
A variable that does not have a value is ____
Undefined
Can you declare and initialize at the same time
Yes
What are camel cases
lower case then upper case letters to read something easier
does case matter
yes
Can you put spaces in variables
no
Can variables begin with a number
no
Can variables end with a number
yes
Can variables contain symbols
No
How do you ask the user a question?
var b = prompt()
How do you output with a variable you just made
alert(“hi” + b)
What is a floating point number
A number with decimals
Whats the difference between 123 and “123”
123 is an integer and “123” is a string literal. Written out “123” would be 1,2,3
What is an integer
A whole number
What are the arithmetic operators?
+ - * /
What is an operator
used to assign values, compare values, perform arithmetic operations, and more.
What is the modulus operator
It returns the remainder of a division
Example of modulus
var tot = 5/2
document.write( modulus)
What does /t mean and where can you use it
tab forward
alert
What does <br></br> mean and where can you use it
break/new line
document.write
What is a shortcut of * something or adding something to a variable that you have defined
(also explain in long terms what this is written out as)
var score = 10
score *= 10
score /= 10
(score = score * 10)
(score = score / 10
Whats an increment operator?
- example
- adding 1 to a variable
z++; instead of z = z+1
Whats a decrement operator?
- example
- subtracting 1 from a variable
z–; instead of z = z-1
What is a numerical literal
a literal saved as a number that you can perform operations with
How do you change something from a string literal into a number
var b = Number(42)
How do you make someting into a floating point #
var b = Parse.float(42)
What is var b = Parse.float(42)
Turning a number into a floating poit number
How do you make a number down to two decimal places
number.toFixed(2)
How do you generate a random # between 0 and 1
var a = Math.random();
How do you find the smallest # in a line of #’s
var b = Math.min(45, 34, 67, 90, 126, 54, 39, -19);
How do you find the biggest # in a line full of #’s
var c = Math.max(45, 34, 67, 90, 126, 54, 39, -19);
How do you round a number
var d = Math.round(4.7);
How do you round a number always down
var e = Math.floor(4.7)
How do you round a number always up
var f = Math.ceil(4.7)
How do you generate pi
var g = Math.PI
How do you power a number
var h = Math.pow(2,4)
How do you generate a random number between 1 and 100?
var i = Math.floor(Math.random() * 100) + 1;