Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Assign the above variable 'bar' to an anonymous function with the following
- * properites.
- * @param {float[]} doubleArray - an array of floating point numbers.
- * The function should multiply every number in the array by 2 (this should
- * change the content of the array).
- * @return {boolean} - true if the operation was sucessful, false otherwise.
- * This should return false if any value in the array cannot be doubled.
- */
- //your code here
- bar = function( doubleArray)
- {
- for (var i = 0; i < doubleArray.length(); i++)
- {
- doubleArray[i] = 2 * doubleArray[i];
- if (doubleArray[i] == Nan)
- {
- return false;
- }
- return true;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement