├── README.md ├── default.js ├── class.js ├── letconst.js ├── template.js ├── inheritance.js ├── threedots.js ├── arrow.js └── destructure.js /README.md: -------------------------------------------------------------------------------- 1 | # es6-practice-bangla 2 | -------------------------------------------------------------------------------- /default.js: -------------------------------------------------------------------------------- 1 | function add(num1, num2 = 20){ 2 | return num1 + num2; 3 | } 4 | 5 | const total = add(15, 1); 6 | console.log(total); -------------------------------------------------------------------------------- /class.js: -------------------------------------------------------------------------------- 1 | class Student{ 2 | constructor(sId, sName){ 3 | this.id = sId; 4 | this.name = sName; 5 | this.school = "kolimunnesa school" 6 | } 7 | } 8 | 9 | const student1 = new Student(12, "Shuvo"); 10 | const student2 = new Student(22, "mahiya"); 11 | const student3 = new Student(29, "Bappi"); 12 | console.log(student3); -------------------------------------------------------------------------------- /letconst.js: -------------------------------------------------------------------------------- 1 | const hubby = "Elias Kanchon"; 2 | console.log(hubby); 3 | 4 | const numbers = [12, 45]; 5 | numbers[1] = 88; 6 | numbers.push(12); 7 | const nayok = {name:"sakib khan", phone:4578}; 8 | 9 | //console.log(numbers); 10 | 11 | let patientName = "Rahim Chacha"; 12 | patientName = "Fatema Khala"; 13 | console.log(patientName); 14 | let sum = 0; 15 | for(let i = 0; i < 10; i++){ 16 | sum = sum + i; 17 | } 18 | console.log(i); -------------------------------------------------------------------------------- /template.js: -------------------------------------------------------------------------------- 1 | const firstName = "Justin"; 2 | const lastName = "TimberLake"; 3 | const fullName = firstName + " " + lastName + " is a good boy"; 4 | const fullName2 = `${firstName} ${20+50+30} is a good boy.`; 5 | 6 | const multiLine = "I love you\n" 7 | + "I miss you\n" 8 | + "I need you"; 9 | 10 | const multiLine2 = `I love you 11 | I miss you 12 | no. I don't need you 13 | Baily road e dorkar nai.` 14 | 15 | console.log(multiLine2); -------------------------------------------------------------------------------- /inheritance.js: -------------------------------------------------------------------------------- 1 | class Parent { 2 | constructor(){ 3 | this.fatherName = "Schwerznegger"; 4 | } 5 | } 6 | class Child extends Parent{ 7 | constructor(name){ 8 | super(); 9 | this.name = name; 10 | } 11 | getFullName(){ 12 | return this.name + " " + this.fatherName; 13 | } 14 | } 15 | 16 | const baby = new Child("Arnold"); 17 | const baby2 = new Child("Tom"); 18 | console.log(baby.getFullName()); 19 | console.log(baby2.getFullName()); -------------------------------------------------------------------------------- /threedots.js: -------------------------------------------------------------------------------- 1 | const ages = [12, 14, 16, 13, 17]; 2 | const ages2 = [15, 16, 12]; 3 | const ages3 = [25, 36, 22, 29]; 4 | const allAges = ages.concat(ages2).concat([5]).concat(ages3); 5 | const allAges2 = [...ages, ...ages2, 5, ...ages3]; 6 | //console.log(allAges2); 7 | const business = 650; 8 | const minister = 450; 9 | const sochib = 250; 10 | const takaPoisa = [650, 450, 250, 850]; 11 | // const maximum = Math.max(business, minister, sochib); 12 | const maximum = Math.max(...takaPoisa); 13 | console.log(maximum); -------------------------------------------------------------------------------- /arrow.js: -------------------------------------------------------------------------------- 1 | // function doubleIt(num){ 2 | // return num * 2; 3 | // } 4 | 5 | // const doubleIt = function myFun(num){ 6 | // return num * 2; 7 | // } 8 | 9 | const doubleIt = num => num * 2; 10 | const add = (x, y) => x + y; 11 | const give5 = () => 5; 12 | const doMath = (x, y) => { 13 | const sum = x + y; 14 | const diff = x - y; 15 | const result = sum * diff; 16 | return result; 17 | } 18 | 19 | const result = add(50, 70); 20 | const result2 = give5(); 21 | const result3 = doMath(7, 5); 22 | console.log(result3); -------------------------------------------------------------------------------- /destructure.js: -------------------------------------------------------------------------------- 1 | const person = { name: 'Jack William', age: 17, job: 'facebooker', gfName: 'Ema Watson', address: 'Kochu Khet', phone: '01717112211', friends: ['Tom hancks', 'tom cruise', 'Tom yarn'] } 2 | 3 | const { address, phone, gfName, salary } = person; 4 | // const gfName = person.gfName; 5 | // const phone = person.phone; 6 | 7 | // console.log(gfName, phone, salary, address); 8 | // console.log(gfName, phone, salary, address); 9 | 10 | 11 | const friends = ['Sakib Khan', 'Arman Khan', 'Aamir Khan', 'Salman Khan', 'sharukh khan']; 12 | const [chotoFriend, ...olderF] = friends; 13 | console.log(olderF) --------------------------------------------------------------------------------