PDA

View Full Version : Don't name things "date"


antun
07-01-2003, 12:50 PM
This isn't really an LZX-specific tip (neither does it apply to just the word "date"!) but it can save you a lot of grief. Use care when naming views and objects. In this example, today's date is not going to be written out, because the view named "date" conflicts with the native JavaScript Date() constructor function:


<canvas debug="true">
<view name="date" />
<script>
var d = new Date();
debug.write( d );
</script>
</canvas>


It would be better to have named it "myDate" or "dayOfMonth".

Enjoy!