Can´t figure out why this function doesn´t work

I fail to see why this doesn´t return true. Any ideas?

function checkNumber(num) {
  if( num % num ===1 && num % 1 === num) {
    return true;
  };
}
checkNumber(10);

I’ve edited your post for readability. 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 easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

It does not return true because num % num is 0 and num % 1 is also 0. Remember that % divides two numbers and returns the remainder.

I don’t think that you understand what the % operator does.
num % num will never equal 1 and num % 1 will only equal num if num is 0.

Hahaha, I was just working out that as you said it! I feel so dumb. Thanks a lot!

Thank you, I just realised that.