From a07aa9833dffc5b746356f5de0a3aa481dba7916 Mon Sep 17 00:00:00 2001 From: Larry Lu Date: Tue, 4 Dec 2018 12:43:44 +0800 Subject: [PATCH] Make description and example better --- snippets/isValidJSON.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/snippets/isValidJSON.md b/snippets/isValidJSON.md index 51b9270a2..3ad0f98d5 100644 --- a/snippets/isValidJSON.md +++ b/snippets/isValidJSON.md @@ -1,13 +1,13 @@ ### isValidJSON -Checks if the provided argument is a valid JSON. +Checks if the provided string is a valid JSON. -Use `JSON.parse()` and a `try... catch` block to check if the provided argument is a valid JSON. +Use `JSON.parse()` and a `try... catch` block to check if the provided string is a valid JSON. ```js -const isValidJSON = obj => { +const isValidJSON = str => { try { - JSON.parse(obj); + JSON.parse(str); return true; } catch (e) { return false;