?? javascript
❤ We will always love you javascript! ❤
javascript
let str = "12345.00";
str = str.substring(0, str.length - 1);
console.log(str);
Arrow Functions
// The usual way of writing function
const magic = function() {
return new Date();
};
// Arrow function syntax is used to rewrite the function
const magic = () => {
return new Date();
};
//or
const magic = () => new Date();
js arrow function this
const person = {
firstName: 'Viggo',
lastName: 'Mortensen',
fullName: function () {
return `${this.firstName} ${this.lastName}`
},
shoutName: function () {
setTimeout(() => {
//keyword 'this' in arrow functions refers to the value of 'this' when the function is created
console.log(this);
console.log(this.fullName())
}, 3000)
}
}
javascript
const javascript = 'Hello world';
console.log(javascript);
() = javascript
//Normal function
function sum(a, b) {
return a + b;
}
//Arraw function
let sum = (a, b) => a + b;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us