0
What is mean of " => " in JavaScript.
Please anyone tell me what is mean of " => " in JavaScript.
3 Answers
+ 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