Book Image

Object-Oriented JavaScript

Book Image

Object-Oriented JavaScript

Overview of this book

Table of Contents (18 chapters)
Object-Oriented JavaScript
Credits
About the Author
About the Reviewers
Preface
Built-in Functions
Regular Expressions
Index

Exercises


  1. What is the result of executing each of these lines in the console? Why?

    • var a; typeof a;

    • var s = '1s'; s++;

    • !!"false"

    • !!undefined

    • typeof -Infinity

    • 10 % "0"

    • undefined == null

    • false === ""

    • typeof "2E+2"

    • a = 3e+3; a++;

  2. What is the value of v after the following?

    >>> var v = v || 10;

    Experiment by first setting v to 100, 0, null, or unset it (delete v).

  3. Write a script that prints out the multiplication table. Hint: use a loop nested inside another loop.