How would I do something like this in javascript:
var s = '124sdg'; var f = 'hsdsda'; if (s.startsWith(a number)) { // Return true } if (f.startsWith(a number)) { // Return false }
Python String isdigit() The isdigit() method returns True if all characters in a string are digits. If not, it returns False .
You can do something like: if ( str. startsWith("00") && ! str.
You can use a regular expression:
if (s.match(/^\d/)) { // Return true } if (f.match(/^\d/)) { // Return false }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With