Javascript program(output issue)

To begin I’m in a beginners programmer class at the University. As part of an assignment I had to write a program to help decide the type of shoes to wear based on specific types of weather. I cannot get the output to work. Please tell me where I’ve messed up and if there are any suggestions on the code. Thanks.

You’ll need to show us what code you have so far, as we can’t diagnose much from what you’ve posted so far.

1 Like

I’m sorry. This is also my first time on the site, and when I paste the code in it renders the program instead of showing the program.

Hey Aaron,

Watch out in those IF checks - you’re using the assignment operator (=) rather than the comparison operators (== or ===).

In the if condition section, you are using a single equals sign. For example:

// bad code
if (text = hot) {

That will not compare the two. Instead, the variable called hot which currently is an undefined variable, is assigned to variable called text.

Clearly that’s not what you want to occur. Instead, you should use a triple-equals to compare (not a double, that’s messy and not worth getting in to at this stage), and place string delimeters around the word.

// better code
if (text === "hot") {
1 Like

okay Ive made that change but it still will not give me the output. Any other suggestions?

You are all my heroes. by adding the
==, and the “”, it is now functioning.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.