0

I want to try out some simple es6 javascript in codepen. i have followed their suggested configuration according to their blog post: https://blog.codepen.io/2015/05/19/babel-now-on-codepen-write-es6-javascript-and-react-jsx/

Here is the sample code:

const features = {
  'PLAN_CATEGORY_BASIC': {
    'BASIC',
    'STANDARD_SUPPORT',
  },
  'PLAN_CATEGORY_SUPER' : {
    'BASIC',
    'STANDARD_SUPPORT',
  },
 }

console.log(features);

However codepen flagged a syntax error

enter image description here

I don't think it is a valid error. How can I fix it?

Attached is my pen configuration.

enter image description here

1 Answer 1

2

Your code is simply syntactically incorrect:

Object literals must have key:value pairs or the short way of that using identifier, but it's not valid to pass a string literal there like

{'basic', 'standard'}

So you probably want arrays, or use a proper object literal syntax.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.