Solved

Does the Rhino javascript engine consider byte a keyword?

Posted on 2009-03-31
5
388 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

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

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

738 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