Java Reference
In-Depth Information
Summary
In this chapter, we've learned the following:
• Bugs are unavoidable in code and it's best to find them early rather than later.
• JavaScript can be put into strict mode using the string "use strict" . This can
be used in a whole file or just a single function.
• Linting tools can be used to ensure that your code follows good practice and con-
ventions.
• Feature detection can check whether a method is supported before calling it, helping
to avoid an exception being thrown.
• The console and browser's built-in debugging tool can be used to interactively find
and fix bugs in code.
• Exceptions can be thrown using the throw statement.
• An error object is created when an exception occurs.
• Any code placed inside a try block will pass any error objects to a catch block
when an exception occurs. Any code inside a finally block will run if an excep-
tion does or does not occur.
• Test-driven development is the practice of writing tests that fail, then writing the
code that passes the test, then refactoring the code every time a new feature is im-
plemented.
• The Jasmine framework can be used to write specs that test code in a structured way.
In the next chapter, we'll be taking a look at the concept of functional programming in
JavaScript.
[3] The factors, or divisors, of a number are any integers that divide exactly into the number
without leaving a remainder, for example, the factors of 6 are 1, 2, 3, and 6
Search WWH ::




Custom Search