const isValidJSON = string => { try { JSON.parse(string); return true; } catch (error) { return false; } }; let check1 = isValidJSON(‘{“title”: “javascript”, “price”: 14}’); // true let check2 = isValidJSON(‘{“title”: “javascript”, “price”: 14, subtitle}’); // false