why does typeof data.cellValue return int value as string??

why does typeof data.cellValue return int value as string??

AddupAddup Posts: 11Questions: 5Answers: 0

I'm doing and if statement on rowcallback to find the datatype of the cell value and it returns ints as string?
am I missing something?

if (typeof data.cellValue === 'string') {
console.log(data.cellValue +' is '+ typeof data.cellValue ) // returns '181818 is string'
$(row).find('td:eq(1)').css('color', 'orange');
}
else{
$(row).find('td:eq(1)').css('color', 'black');
}

Answers

  • kthorngrenkthorngren Posts: 20,141Questions: 26Answers: 4,735

    My guess is that the data is sourced from the DOM or the ajax response has those values as a string.

    Kevin

  • AddupAddup Posts: 11Questions: 5Answers: 0

    correct int are as "65" etc i figured something already

  • tangerinetangerine Posts: 3,342Questions: 35Answers: 394

    correct int are as "65" etc i figured something already

    What do you mean?

  • kthorngrenkthorngren Posts: 20,141Questions: 26Answers: 4,735

    correct int are as "65" etc

    Then that is why they are strings instead of integers.

    Kevin

This discussion has been closed.