if statement in javascript string code example Example: if string javascript if (typeof myVar === 'string') { /* code */ };