This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Big O Forum

View Course » View Exercise

596 points
8850012cd92e000e3bd64ead14d51f25?s=140&d=retro
Submitted by
dumbgirl
over 5 years ago

Are there errors in the code?

Hi, I found the correct answer: O(2^n).
However, I think there are problems in the code:

  • console.log(binary(3)); gives me TypeError:&nbspObject.keys&nbspis&nbspnot&nbspa&nbspfunction
  • isn't it better to insert ; after } in lines 8 and 11?
  • I'm not so sure the given code really calculates an array of all binary strings of length n; if it does, I don't understand why. I can't try it and figure it out because of the error I get. Thank you for your attention, bye! M.

0 votes

permalink

I couldn't say why you might be getting that error... Try using the reset button and see if the error persists. If that doesn't work then try switching browsers.

389 points
4f8f6ea95a87fe00030031ad_732049700
Submitted by
Eric Summers
about 5 years ago

1 Comment

4f8f6ea95a87fe00030031ad_732049700 Eric Summers about 5 years ago

Also, the semicolons on 8 and 11 are optional. Feel free to include them if you like, but the code works without them.