How can I make this function that checks whether a number is a palindrome better? I have this code:
export function is_palindrome(num: number): boolean {
    return [...num.toString()].reverse().join(&quot;&quot;) === num.toString();
}

which checks if a number is a palindrome(i.e 9009 reversed is still 9009), I do this by using the spread operator on num.toString(), reversing the array, joining it, and then comparing it to num.toString() which works but surely there must be a better way to do this.
It looks fine - note that for a function this small there will almost always be no real impact on runtime, nor on readability. The only thing I would change is avoiding converting num into a string twice.
It is also possible to check for a palindrome without explicitly reversing the string, which I have done below.
export function is_palindrome(num: number): boolean {
    const str = num.toString();
    const len = str.length;
    for (let i = 0; i &lt; Math.floor(len / 2); i++) {
        if (str[i] !== str[len - i - 1]) {
            return false;
        }
    }
    return true;
}