Leetcode power of three

all test cases pass like 27 true 11 true 10 true but 45 is uppose to be false but its outputs true

/**
 * @param {number} n
 * @return {boolean}
 */
var isPowerOfThree = function(n) {
    let div = n/3;
    if(n > 0){
    if( n %3 === 0){
        return true;
        }else{
 return false;
        }
        }else{
        return false;
        }
};

You need to check whether a number is a power of three or not.
but, what you did was to check whether a number is a multiplication of three or not.

An integer n is a power of three, if there exists an integer x such that ( n == 3x )

And an integer n is a multipliation of three, if n is the result of multiplying 3 by another whole number x such that ( n == 3 * x ) (way of checking if the remainder is 0)


So trying your code with 45 will return true cause 45 = 3 * 15

27 will return true ( 27 = 3 * 9 )
11 will return false ( there is no integer value for x so that 11 = 3 * x )
10 will return false ( same as 11 )