This may sound like a dumb question, but is it possible to have a 0 at the start of a number check, and have it work?
This is what I have:
function checkCosts() {
var date = document.getElementsByName("date")[0].value;
var roomtype = document.getElementsByName("roomtype")[0].value;
var night = document.getElementsByName("night")[0].value;
var month = date.substring(0, 2);
var year = date.substring(8, 10);
var day = date.substring(4, 6);
var time = month.concat(year);
var fulldate = day.concat(time);
if (time >= 0415 && <= 0915) {
if (roomtype == "Classic") {
if (night == "3") {
document.getElementById("cost").innerHTML = "1,480";
}
}
}
}
However, when I run it in jslint.com I get the following errors:
Unexpected '4' after '0'.
if(time >= 0415 && <= 0915){
line 9 column 28Unexpected trailing space.
if(time >= 0415 && <= 0915){
What's there is just one of a few different statements, all the variables will be used.
It would be possible to convert the strings into ints, but I don't know how to do this/if it will work.