Js Flashcards
How can we deleet everything in chrome Console ?
type: clear
or
ctrl + k
How to get to console directly ?
command + option + j
or
got to view => developer=> javascript console
+
addition
-
subtraction
*
Multiplication
/
Division
%
Modulo
what is prder operations ?
PEMDAS
what is PEMDAS
parantheses, exponents, Multiplication, division, addition, substraction
how can i recall previous run lines ?
with up/down arrow
how tp make a comment in Js ?
with //
modulo known also as ?
remeinder operator
how to to pronaunce modulo ?
madulo
what means 9%2
it means two goes into nine how many time as a whole number, and how much will be remain ?
9%2 = 1
modulo ist commen to use where ?
to determine if a number is even or odd
how to write 2²?
2**2
what Nan stand for ?
not a number
NaN consider as what is js ?
consider as a number
0/0 =
NaN
how to check js consider an ellement as what ?
with command typeof
ex: typeof 4 = number
what is variable ?
it is the way of giving some name to a value and sorting it using js.
how we make a variable ?
let year =. 1985;
how to update the value of a variable ?
imagine we have let numApple = 4;
- write it again : numApple = 5;
or
-numApple = numApple + 1
or
-numApple +=5
-numApple -=5
- if i had totalFruits= numApple + num Orange in previouse liene and than I updated numApple, how can i update totalFruits value ?
just write totalFruits= numApple + num Orange again
score ++; =
score+=1;
score–; =
Score-=1;
what Const stand for ? and what is it ?
Constant, it is a value that does not change
What is VAR ?
BEFORE LET AND CONST, VAR was the only way of Declaring variables. these days it is not commen to use.
How many optons do we have for a Boolean value ?
two, true or false
Whats is Booleann use to ?
to store yes or no, True or false
Ex numPuppies = false;
js hard ruls:
-we cant have space between our name
- we cant have number at begining of my name
- the Names are case sensitiv
these names can contain also $ and
what is the other name for Number ?
identifier
what is the name of this type of typing numberOfBoys ?
camel cased
by Boolean it is better how to name them ?
instead of gameOver = True;
isGameOver
What is String ?
It textual information, they reprecents text, and they must be wrapped in quots.
let username = “pouya”;
- we can have space in between
-we can have $
-we can have numbers
-it can be zero character lang
- we can use one string inside another string
“I´love´you “
- we cant do like that
“I”love”you “
string index start with which number ?
0
How can I access indexes of my string ?
let animal = “cat”;
animal[1] = “a”
what is concatenation ?
“lol”+”lol”= “lollol”
a combination of number and string is :
string
msg.toUppercase ()
what is toUpperCase () ?
it is a method
with which method can we upper case our string ?
.toUpperCase ()
with which method can we lower case our string ?
.toLowerCase ()
what is trim Method ?
it is going to trim off any whitespace at the begining of a string or at the end.
we can chain methids together
.
what is arguments ?
are inputs that we can pass into the method to alter how they behave
ex: searchFor(“a”) “a” is an argument.
what is indexOf method?
its going to give us the string index and positional number where a given argument occurs in a string.
what is slice method?
it can accept more than one argument .
it is going to extract or slice a portion of a string and it returns it or give it to us as a new string.
let msg = “haha that is so funny!”
msg.slice(5) =”that is so funny!”
or
“haha that is so funny!”.slice(5)
or
msg.slice(5, 10)
what is replace method?
msg.replace (“haha”,”lol”)
what is repeat method?
“lol”.repeat(10) = “lollollollollollollollollollol”
what is Template Literal ?
these Templates allows us to create strings where we can embed an expression inside the string and that expression will be evaluated and turned into a string.
´I counted ${x+y} sheep´