I have this code:
wallboard.data.Timer = function () {
$("div[data-value]").each(function () {
var time = $(this).attr("data-value");
if (time > 0) {
time += 1000;
$(this).attr("data-value", time).text(TimeToText(time));
}
});
}
The function TimeToText()
simply takes a millisecond value and output it as hour:seconds (00:00)
.
The attribute data-value
contains a millisecond value and is stores in the variable time
.
This is my "debug" output:
var time = $(this).attr("data-value");
time = 4376
if (time > 0) {
is true as 4376 is larger than 0
time += 1000;
after this "time" is 43761000 - her it starts concatenating the text "4376" and "1000" and this is the proof that the JavaScript engine thinks time is a string type.
How do I make it clear that time should be an integer type?