So im a newbie and I need some basic help. I wanna make a program that checks whether room is free or taken. I dont know if i can make just a variable with all free rooms or should i do this the other way. I'm kinda stuck on solving the problem.
function action() {
var room = document.getElementById('text');
var free = [1, 2, 3];
if (room.value == free) {
alert('Hello');
} else {
alert('Taken');
}
}
document.getElementById('button').onclick = function() {
action();
}
I wanna ask if is it possible to just compare variable i enter to other variable with list of free rooms if not, how to make this work then?