Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Is there a way to define immutable parameters in ES6?
- const inc = x => {
- x++; // Oh no, you modified x!
- return x;
- }
- // Is it better to reassign to const (if it should be constant, of course)?
- const inc = x => {
- const x = x;
- x++; // Booop... x is readonly!
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement