Click here to Skip to main content
15,884,298 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
(THE FILE NAME IS: test.js)
Here is the problem:
JavaScript
var Hardware = prompt("What are the physical components of the computer, such as the moniter and system unit, called?");
if (Hardware.toLowercase() == "hardware") {
		var number = 1;

} else { alert("You have failed the test. Please refresh.");     }
if (number == 1) {


}

Now, the problem is that I get a typeError whenever I run this, which states:
Quote:
Uncaught TypeError: Hardware.toLowercase is not a function
at test.js:2


What I have tried:

I have tried looking to see if others have had this same problem; I don't think anyone has.
Posted
Updated 21-Nov-17 15:20pm

It should be
toLowerCase()
Watch up for case sensitivity.
 
Share this answer
 
v2
Hi, Javascript is case sensitive. I've fixed your code, check it now.

var Hardware = prompt("What are the physical components of the computer, such as the moniter and system unit, called?");
alert(Hardware);
if (Hardware.toLowerCase() == "hardware") {
		var number = 1;
 
} else { alert("You have failed the test. Please refresh.");     }
if (number == 1) {
  alert ("Hello I love to be 1")

}


Happy Coding!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900