Solved

Does the Rhino javascript engine consider byte a keyword?

Posted on 2009-03-31
5
382 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 167 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 83 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 167 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today I would like to talk about localizing (Internationalization) JavaScript applications. Introduction When creating an application that is going to be used by many people around the globe, it is important to remember that not everyone speak…
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…

914 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now