Check if a string represents a hexadecimal number or not | Function to check if the string represents a hexadecimal number ; Size of string ; Iterate over string ; Check if the character is invalid ; Print true if all characters are valid ; Given string ; Function Call
function checkHex ( s ) { let n = s . length ; for ( let i = 0 ; i < n ; i ++ ) { let ch = s [ i ] ; if ( ( ch < ' ' ch > ' ' ) && ( ch < ' ' ch > ' ' ) ) { document . write ( " " ) ; return ; } } document . write ( " " ) ; } let s = " " ; checkHex ( s ) ;