New ES6 Features
React
MongoDB
Meteor
This will take 5 weeks ⇒ 1month + 1 week
New ES6 Features (Half a week)
- Re-Introduction to Programming Languages
- What is ES6 Classes
| function calculateExactAge(bornYear=1995, currentYear=2018){ | |
| console.log(currentYear - bornYear); | |
| } | |
| calculateExactAge(); // 23 | |
| calculateExactAge(2010, 2020); // 10 |
| // cheap fix | |
| function calculateAge(bornYear, currentYear){ | |
| if(bornYear !== undefined && currentYear !== undefined){ | |
| console.log(currentYear - bornYear); | |
| } else { | |
| console.log("provide both year values") | |
| } | |
| } | |
| calculateAge(2000, 2018); // 18 |
| function calculateAge(bornYear, currentYear){ | |
| console.log(currentYear - bornYear); | |
| } | |
| calculateAge(2000, 2018); // 18 | |
| calculateAge() // NAN |
| const name = "Johnaas" | |
| const age = 35; | |
| const city = "lusaka"; | |
| const message = `my name is ${name} am ${age} years old and I live in ${city}` | |
| console.log(message); // "my name is Johnaas am 35 years old and I live in lusaka" |
| const name = "Johnaas" | |
| const age = 35; | |
| const city = "lusaka"; | |
| const message = "my name is "+ name + ", am " + age + "years old and I live in " + city; | |
| console.log(message); // "my name is Johnaas, am 35years old and I live in lusaka" |
| const person = { | |
| name: "Johnaas", | |
| job:"dev", | |
| siblings: 2, | |
| friends: "loading ..", | |
| }; | |
| const { name, ...obj } = person; | |
| console.log(name); // Johnaas | |
| console.log(obj); | |
| /* |
| const items = [1, 2, 3, 4, 5 ]; | |
| if(items.includes(5)){ | |
| console.log(true) // true | |
| } | |
| if(items.indexOf(5) > -1){ | |
| console.log(true); // true ; | |
| } |
| /* HOC fundamentally is just a function that accepts a Component and returns a Component: | |
| (component) => {return componentOnSteroids; } or just component => componentOnSteroids; | |
| Let's assume we want to wrap our components in another component that is used for debugging purposes, | |
| it just wraps them in a DIV with "debug class on it". | |
| Below ComponentToDebug is a React component. | |
| */ | |
| //HOC using Class | |
| //it's a function that accepts ComponentToDebug and implicitly returns a Class | |
| let DebugComponent = ComponentToDebug => class extends Component { |
| var filenameFull = "tm_icons.png"; | |
| //Regex to remove | |
| var filenameText = filenameFull.replace(/\.[^/.]+$/, ""); |
New ES6 Features
React
MongoDB
Meteor
This will take 5 weeks ⇒ 1month + 1 week
New ES6 Features (Half a week)