loading...

Rewriting normal function as arrow function

318097 profile image Mehul Lakhanpal Originally published at codedrops.tech ・1 min read
const func = function() {
    console.log('a');
    return 5;
};
func();

Equivalent arrow function of the above Regular function

const func = () => (console.log('a'), 5);
func();

Thanks for reading πŸ’™

Follow @codedrops.tech for daily posts.

Instagram ● Twitter ● Facebook

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript

codedrops.tech

Discussion

pic
Editor guide