I have a function that I am trying to convert to the new arrow syntax in ES6. It is a named function:
function sayHello(name) {
console
You could skip the function part and the arrow part to create functions. Example:
class YourClassNameHere{
constructor(age) {
this.age = age;
}
foo() {
return "This is a function with name Foo";
}
bar() {
return "This is a function with name bar";
}
}
let myVar = new YourClassNameHere(50);
myVar.foo();
No. The arrow syntax is a shortform for anonymous functions. Anonymous functions are, well, anonymous.
Named functions are defined with the function
keyword.