-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e36ee75
commit 4221054
Showing
2 changed files
with
144 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>repeat_lesson_5</title> | ||
</head> | ||
<body> | ||
|
||
|
||
<script src="main.js"></script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
// alert(22); | ||
|
||
// function foo() { | ||
// console.log('qwe'); | ||
// } | ||
// foo(); | ||
|
||
|
||
// foo(); | ||
// function foo() { | ||
// console.log('qwe'); | ||
// } | ||
|
||
|
||
// foobar(); | ||
// let foobar = function () { | ||
// console.log('asdfgghjjk'); | ||
// } | ||
|
||
// let foobar = function () { | ||
// console.log('asdfgghjjk'); | ||
// } | ||
// foobar(); | ||
// | ||
// | ||
// | ||
// | ||
// | ||
// let calc = function (a,b) { | ||
// return a+ +b; | ||
// } | ||
// let res = calc(10, 20); | ||
// console.log(res); | ||
// | ||
// | ||
// let calculator = (a,b)=> a + b; | ||
// | ||
// let result = calculator(1, 2); | ||
// console.log(result); | ||
|
||
|
||
// | ||
// let foobar = (...rest)=> console.log(rest); | ||
// foobar(1, 2, 3); | ||
// | ||
// | ||
// let foo = ()=> console.log(arguments); | ||
// foo(1,2,3); | ||
|
||
//fn declaration & fn expression __ arguments + | ||
// fn arrow __ arguments - | ||
|
||
// ...rest (rest arguments)___works in all fn | ||
|
||
|
||
|
||
function foo() { | ||
console.log('hi'); | ||
} | ||
let x = function () { | ||
console.log('hello'); | ||
} | ||
|
||
|
||
let fnArr = [foo, x, z = () => console.log('aloha')]; | ||
|
||
fnArr[0](); | ||
fnArr[1](); | ||
fnArr[2](); | ||
|
||
console.log('--------------'); | ||
|
||
|
||
let user = { | ||
name: 'kokos', | ||
age: 31, | ||
greeting : function () { | ||
console.log('hello my friends'); | ||
} | ||
} | ||
user.greeting(); | ||
|
||
let user2 = { | ||
name: 'kokos', | ||
age: 31, | ||
greeting() { | ||
console.log('hello, my name is - ' + this.name); | ||
} | ||
} | ||
user2.greeting(); | ||
|
||
|
||
let user3 = { | ||
name: 'kokos', | ||
age: 31, | ||
greeting : ()=> { | ||
console.log('aloha, my name is - ' + user3.name); | ||
} | ||
} | ||
user3.greeting(); | ||
|
||
|
||
|
||
let user4 = { | ||
name: 'kokos', | ||
age: 31, | ||
greeting : function () { | ||
console.log('hello'); | ||
}, | ||
wife : { | ||
name: 'qweasdz', | ||
greeting(){ | ||
console.log('hi, my name is - ' + this.name); | ||
user.greeting(); | ||
} | ||
} | ||
} | ||
|
||
user4.wife.greeting(); | ||
|
||
|
||
console.log('------------------'); | ||
|
||
|
||
let loop = (arr)=>{ | ||
for (const arrElement of arr) { | ||
console.log(arrElement); | ||
} | ||
} | ||
|
||
loop([1, 2, 3]); |