Javascript
Javascript
4.793
Math.round((1899+2095+799)*0.1)/100
4.79
Math.floor(((1899+2095+799)*0.1)/100)
Math.round(((1899+2095+799)*0.1)/100)
alert('hello');
'hello' +3
'hello3'
'$' +20.95+7.99
'$20.957.99'
'$' +(2095+799)/100
'$28.94'
popup hello
man
undefined
`hello`
'hello'
'purpose of backtick'
`interpolation`
'interpolation'
`iteam (${1+1}): $${(2095+799)/100}` No of iteams('+(1+1)+')total cost $'+(5+3)
'some \ntext'
Class 05
1. Variable = a way to save values
2. Re-assign a variable
3. Created the cart Quantity feature
4. Shortcuts for re-assigning and best practices
5. Naming conventions and best practices
6. 3 ways to create a variable: let , const, var
7. Ex 2.42
++ ; variable =variable + 1
Naming Conventions
>=
Equal to ===
Divide 0 to 1 into three parts (0 to1/3 ; 1/3 to 2/3; 2/3 to 1) and assignee each part for R/P/S
Order of operation
1. BODMAS
2. Comparison
3. Logical operation (AND--&&-- Both are true;
4. OR || any one is true ;
5. NOT ! flip the value)
In if else all elements will be present only inside the curly brackets called ‘scopes’
‘Truthy’ value
|| - Default Operator –
! – not
inside the object you can put multiple values, it is another type of value
const product ={
name : 'socks',
price: 1090
};
product.name
1. Let us group multiple values together
2. Let us use multiple values together
BUILD-IN OBJECTS
1. math.random()
2. console.log()
3. JSON (JavaScript Object Notation)
a. Similar to JS object
b. But with less features
c. More universal
4. localStorage
5. 401K
projects in-complete
objects group multiple values to gether
Math.random();
localStorage.setItem('score',JSON.stringify (score));
JSON.parse(localStorage.getItem('score'))
console.log()
document.body.innerHTML = 'hello';
document.title ='good job !';
onclick = click
Onscroll = scrolling
Projects to be completed
1. Last two