How would I display positive number such as 3 as +3 and negative numbers such -5 as -5? So, as follows:
1, 2, 3 goes into +1, +2, +3
but if those are
Even though using ternary operator is arguably more practical, here's another interesting way of doing this:
'+'.repeat(number >= 0) + number
or this:
[['+'][number & 0x80000000], number].join('')