if condition with string js code example Example: if string javascript if (typeof myVar === 'string') { /* code */ };