JSFiddle - React, Tailwind, and code Playground

by btipling

JavaScript

var test = ['apple', null];

test.forEach(function(currentFruit) {
    if (toString.call(currentFruit) === '[object String]') {
      console.log(currentFruit, 'is string');
    } else {
      console.log(currentFruit, 'is not a string');
    }
});