Section 2.5. Questions


2.5. Questions

  1. Of the following identifiers, which are valid, which are not, and why?

  2. $someVariable _someVariable 1Variable some_variable somèvariable function .someVariable some*variable

  3. Convert the following identifiers using the conventions outlined in the first section of the chapter:

  4. var some_month; function theMonth // function to return current month current-month // a constant var summer_month; // an array of summer months MyLibrary-afunction // a function from a JavaScript package 

  5. Is the following string literal valid? If not, how would you fix it?

  6. var someString = 'Who once said, "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former."'

  7. Given a number, 432.54, what JavaScript returns the integer component of the number, and then finds the hexidecimal and octal conversion?

  8. You create a JavaScript function in a library that can be used by other applications. A parameter, someMonth, is passed to the function. How would you determine whether it's null or undefined?

Answers are provided in the appendix.




Learning JavaScript
Learning JavaScript, 2nd Edition
ISBN: 0596521871
EAN: 2147483647
Year: 2006
Pages: 151

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net