DEV Community

Discussion on: Javascript fundamentals before learning react

Collapse
 
sunflower profile image
sunflowerseed • Edited

you said

const add = () => { a + b} ;
Enter fullscreen mode Exit fullscreen mode

there is not even a or b in the param. Also, you open the {, and so you need a return. Otherwise it is going to evaluate a + b and return nothing.

Or just use

const add = (a, b) => a + b;
Enter fullscreen mode Exit fullscreen mode