recently I got a job interview for a web developer position.
They ask me to create a javascript object that keep accurate score in
a ten-pin bowling match for a single player.
I have accomplished my test.
You can run the script at this url http://jsbin.com/arele5,
If you want to edit just go to this link http://jsbin.com/arele5/edit
I have two questions:
1) The javascript object works on google chrome but jsbin complains about the following construction
var bowlingGame = new function(){...};
If I correct the construction in the following way
var bowlingGame = function(){...};
the jsbin says to me that all things are ok, but it doesn’t work in google chrome. Any ideas?
2) I didn’t pass the job interview, indeed I didn’t receive any response; so my second question is:
what would be the best way to solve the exercise?
Thanks,
Antonio
For #1, try:
As for #2, I can’t exactly say why you didn’t get a job, but the spacing of your code, if nothing else, isn’t very pretty to look at. I just wrote this, it’s much more compact and easy to read:
If nothing else, run your code through something like: http://jsbeautifier.org/ if you can’t keep indentation clean…