JavaScript
Checking for Strings

by Benny Neugebauer

if (typeof entity !== 'string') {
  entity = JSON.stringify(entity);
}

entity = (typeof entity !== 'string') ? JSON.stringify(entity) : entity;

Red corner is missing the else block. :)

Florian Keller

Sign in to comment!