Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functions with default parameters are not properly supported #2257

Closed
Swordstone86 opened this issue Aug 15, 2022 · 1 comment
Closed

Functions with default parameters are not properly supported #2257

Swordstone86 opened this issue Aug 15, 2022 · 1 comment

Comments

@Swordstone86
Copy link

Functions with default parameters seem to be throwing SyntaxErrors.

Firmware version: 2v15
Web IDE version: v0.76.1

Input code:

function test(a = 3, b = 4, c = 5) {
  print(a);
}

Error:

Uncaught SyntaxError: Got '=' expected ','
 at line 1 col 17 in .bootcde
function test(a = 3, b = 4, c = 5) {
                ^

Expected result is the function behaves normally with default parameters, and can be called any of the following ways:

test();
test(11);
test(44, 23);
@Swordstone86 Swordstone86 changed the title Default parameters are not properly supported Functions with default parameters are not properly supported Aug 15, 2022
@gfwilliams
Copy link
Member

Hi - Espruino doesn't support all of ES6 - there's a list of features to does/doesn't support here: http://www.espruino.com/Features

I'm going to close this as otherwise we'll just end up with hundreds of bugs for every feature in every ES version that's not implemented - there's already a feature wishlist at #1302 where this is listed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants