0
What is mean of " => " in JavaScript.
Please anyone tell me what is mean of " => " in JavaScript.
2 RĂ©ponses
+ 6
Arrow function expressions
âą https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
**Arrow functions are a different way of creating functions in JavaScript. Besides a shorter syntax, they offer advantages when it comes to keeping the scope of the 'this' keyword.
For example:
function callMe(name) {
console.log(name);
}
which you could also write as:
const callMe = function(name) {
console.log(name);
}
becomes:
const callMe = (name) => {
console.log(name);
}
âą https://code.sololearn.com/WKFF4vOCr3mi/?ref=app
âą https://www.sololearn.com/post/48576/?ref=app
Check this.Out:
const shoutName = name => name.toUpperCase();
console.log(
shoutName('iron manđ»'));// IRON MANđ»
+ 4
It is used for arrow functions. For further reading, check this out:
https://code.sololearn.com/WjYesJgQ383T/?ref=app