Java Reference
In-Depth Information
Figure 10.2. Our first test fails
This shows that our test has failed. Well, what did you expect? We've yet to write any code!
Let's have a go at writing the factorsOf() function in the numberCruncher.js file:
src/numberCruncher.js (incomplete)
"use strict";
function factorsOf(n) {
var factors = [];
for (var i=1; i < n ; i++) {
if (n/i === Math.floor(n/i)){
Search WWH ::




Custom Search