We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1f13f09 commit e60007bCopy full SHA for e60007b
Maths/StandardDeviation.js
@@ -1,7 +1,7 @@
1
/*
2
* Returns the standard deviation given an array of integers
3
- * @param int[] nums array of integers
4
- * @return int standard deviation
+ * @param number[] nums array of integers
+ * @return number standard deviation
5
* @see https://en.wikipedia.org/wiki/Standard_deviation
6
*/
7
function standardDeviation(nums) {
@@ -14,8 +14,8 @@ function standardDeviation(nums) {
14
15
let sum = 0
16
for (let i = 0; i < nums.length; i++) {
17
- if (!Number.isInteger(nums[i])) {
18
- throw new TypeError('Integer type required in array input!')
+ if (isNaN(nums[i])) {
+ throw new TypeError('Number type required in array input!')
19
}
20
sum += nums[i]
21
0 commit comments