var someVar = 5
let someScopeVar = 5
const someConst = 5
theBestCarEver
the_best_car_ever
console.log(x)
let x = 2
let y = 3 *4
let z = x / y
console.log(x+y-z)
let my = 'My name is'
let name = "Alexey"
let result = my + ' ' + name
console.log(result)
console.log(result.length)
console.log(name[0])
console.log(name[1])
console.log(name[2])
let myName = 'My name is Alexey'
myName.slice(11,16)
let name = 'alexey'
let result = name.toUpperCase()
console.log(result)
result = result.toLowerCase()
console.log(result)
let thisCodeIsCool = true
console.log(thisCodeIsCool)
&& (И)
let iHaveAPen = false
let iHaveAPaper = true
let canIWrite = iHaveAPen && iHaveAPaper
|| (ИЛИ)
let iHaveAPen = false
let iHaveAPencil = true
let canIWrite = iHaveAPen || iHaveAPencil
let iHaveAPen = false
let iHaveAPencil = true
let iHaveAPaper = true
let canIWrite = (iHaveAPen || iHaveAPencil) && iHaveAPaper
! (НЕ)
let outside = false
let inside = !outside
! (НЕ)
let outside = false
let iHaveAPen = false
let iHaveAPencil = true
let iHaveAPaper = true
let canIWrite = !outside && (iHaveAPen || iHaveAPencil) && iHaveAPaper
> (больше) и < (меньше)
5 > 7
4 < 8
>= (больше или ровно) <= (меньше или ровно)
4>=5
3<=3
== (равенство)
5=="5"
=== (строгое равенство)
5==="5"
let a
console.log(a)
let b=null
console.log(b)
let myArr = ['apple','orange','kiwi']
myArr[0]
myArr[1]
myArr[2]='berry'
myArr[3] = ['some','other','array']
myArr[3][1]
let myArr = ['apple','orange','kiwi']
myArray.length
myArray[myArray.length-1]
myArray.push('to end')
myArr.unshift('to start')
let myArr = ['apple','orange','kiwi']
let lastElement = myArray.pop()
let firstElement = myArray.shift()
let myArr1 = ['honda','toyota']
let myArr2 = ['hundai','mercedez']
let myArr3 = ['bmw']
let cars = myArr1.concat(myArr2,myArr3)
let cars = ['honda','toyota','hundai','mercedez','bmw']
let index = cars.indexOf('bmw')
let indexNotFound = cars.indexOf('BMW')
let cars = ['honda','toyota','hundai','mercedez','bmw']
let carsString = cars.join(' - ')
let carsString2 = cars.join(' и ')
Math.random()
Math.random() * 100
Math.floor(1.723)
Math.floor(1.32)
Math.floor(1.999999)
const index = Math.floor(Math.random() * 5)
// 0 - 4
const words = ['My','first','word','is','mama']
words[index]
const body = ['глаз' , 'нос' , 'череп']
const adj = ['вонючая','унылая','дурацкая']
const words = ['муха','выдра','дубина','мартышка','крыса']
const b = body[Math.floor(Math.random()*3)]
const a = adj[Math.floor(Math.random()*3)]
const w = words[Math.floor(Math.random()*3)]
const result = 'У тебя ' + b + ' словно ' + a + ' ' + w + '!!!'
1 Сделайте свой генератор дразнилок со своим набором слов
2 Сделайте генератор дразнилок с таким шаблоном
"У тебя [body] еще более [adj], чем [animalBody] у [animal]
используя .join()
Text