Advertisement
Guest User

Untitled

a guest
Apr 17th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2. * Assign the above variable 'bar' to an anonymous function with the following
  3. * properites.
  4. * @param {float[]} doubleArray - an array of floating point numbers.
  5. * The function should multiply every number in the array by 2 (this should
  6. * change the content of the array).
  7. * @return {boolean} - true if the operation was sucessful, false otherwise.
  8. * This should return false if any value in the array cannot be doubled.
  9. */
  10.  
  11. //your code here
  12. bar =  function( doubleArray)
  13. {
  14.  
  15.     for (var i = 0; i < doubleArray.length(); i++)
  16.     {
  17.  
  18.         doubleArray[i] = 2 * doubleArray[i];
  19.  
  20.         if (doubleArray[i] == Nan)
  21.         {
  22.  
  23.             return false;
  24.        
  25.         }
  26.  
  27.         return true;
  28.  
  29.     }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement