Created
October 27, 2021 02:11
-
-
Save dsibinski/3848759ec400644ce6b36326cb5b3e13 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function GetNumberOrLength(variable: string | number): number { | |
if (typeof variable === 'string') { | |
return variable.length; | |
} else { | |
return variable; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment