react-hexgrid
react-hexgrid copied to clipboard
Text should accept number
trafficstars
Text should be accepting numbers as well as strings. Numbers are easily rendered, why not accept them? By converting my numbers to strings I first have to check if number is defined, wasting CPU ticks
you can use implicit type coercion, ( +'' ) as per: let number_twelve = 12 let string_twelve = number_twelve + ''
console.log(typeof(number_twelve)) // number console.log(typeof(string_twelve)) // string
Thank you for the quick response. I think allowing numbers should be okay though. Or is there any other reason why they are not allowed?