Doesn't getting output. getting a small compile error. #help


Getting a small error. Can anyone tell me the syntax in JS ?

function numberOperation(N,M){
if ((((Nx40)+20)-50) > M) {
console.log(“Greater!”);
}
else if ((((N
x40)+20)-50) = M) {
console.log(“Equal!”);
}
else {
console.log(“Lesser!”);
}
}

You haven’t written anything yet! What have you tried so far? Where did you get suck?

you can check now.
I have updated the query.

function numberOperation(N, M) {
  // What is this condition?
  // I don't know what <em>x40 means, but it looks wrong
  if ((((N <em>x40)+20)-50) > M) {
    console.log(“Greater!”);
  }
  // Same question here
  else if ((((N</em> x40)+20)-50) = M) {
    console.log(“Equal!”);
  }
  else {
    console.log(“Lesser!”);
  }
}

You seem to be mixing together these two pieces together. I would execute the three operations and store the result first, and then compare to the value of M.

The star (*) which we used to multiply sign is not showing here. So i used a “x” as showing multiplication.

Can you tell me the syntax. So that i can test against any entry.

You know we don’t write code for users. It’s a strict rule here.

What is this <em> and </em> piece?

If your code isn’t actually what you posted, please post your actual code.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

function numberOperation(N,M){
    if ((((N*40)+20)-50) > M) {
        console.log("Greater!");
    } 
    else if ((((N*40)+20)-50) = M) {
        console.log("Equal!");
    } 
    else  ((((N*40)+20)-50) < M){
        console.log("Lesser!");
    }
}

help by giving hint not answer. Sitting from past 6 hours onto this.

You are repeating this all over the place. Like I said above, I’d store this into a separate variable and use that variable.

This will always be a true condition. = is different than ===.

1 Like

Missing this equal sign thing.
Thank you so very much.

1 Like

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