Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Does the Rhino javascript engine consider byte a keyword?

Posted on 2009-03-31
5
Medium Priority
?
394 Views
Last Modified: 2012-05-06
I'm using the yui compressor and it fails to compile the following chunk of javascript.  Any ideas?

[ERROR] 43:11:missing name after . operator

Here is line 43
this.byte = this.bit = 0;

Thanks!
0
Comment
Question by:nategilman
  • 3
  • 2
5 Comments
 
LVL 41

Expert Comment

by:HonorGod
ID: 24029660
What does it display for:

alert( typeof( byte ) )
0
 
LVL 18

Assisted Solution

by:Morcalavin
Morcalavin earned 668 total points
ID: 24030725
byte is a reserved word in javascript.

http://javascript.about.com/library/blreserved.htm
0
 
LVL 41

Assisted Solution

by:HonorGod
HonorGod earned 332 total points
ID: 24030791
http://javascript.about.com/od/reference/g/rbyte.htm

... The plan to allow specific data types in Javascript no longer exists and byte is therefore no longer on the reserved word list in the latest standards. ...
0
 
LVL 18

Accepted Solution

by:
Morcalavin earned 668 total points
ID: 24030802
What version of rhino are you using?  byte is still in the reserved word list for backwards compatibility reason.  I don't think the ECMAscript specifications use it anymore.  These seems to work fine for me:
window.bit = 'bar';
window.byte = window.bit = 0;
alert(window.byte);

It may be that yui still doesn't allow byte for some reason.
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 24059177
Thanks for the assist, and the points.

Good luck & have a great day
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question