You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 30, 2023. It is now read-only.
Test 8 for the D3 Heat Map is supposed to ensure that the data-month attribute has values between 0 and 11 and it does not always do this. If the data-month attribute has a string value ('January' for example), the test will still pass. The test should be fixed to determine if the data values are numeric, and to fail if they are not.
The code can be fixed by adding a isNaN check to the valuesAreBetween function (near line 182), after converting the data item to a number:
function valuesAreBetween(min, max, data) {
for (var i = 0; i < data.length; i++) {
// Note the use of the unary add (plus sign) before the data element
// to attempt to convert to a number.
var item = +data[i];
if (isNaN(item)) {
return false;
}
if (item < min || item > max) {
return false;
}
}
return true;
}
Issue Description
Test 8 for the D3 Heat Map is supposed to ensure that the data-month attribute has values between 0 and 11 and it does not always do this. If the data-month attribute has a string value ('January' for example), the test will still pass. The test should be fixed to determine if the data values are numeric, and to fail if they are not.
The code can be fixed by adding a isNaN check to the
valuesAreBetween
function (near line 182), after converting the data item to a number:Browser Information
N/A
Your Code / Link to Your Pen
https://codepen.io/tom-p-uk/pen/ZeQEaE
The text was updated successfully, but these errors were encountered: