return false if array exist in localstorage?

Aaron Musktin
var arr= new Array();

arr.push("John");

localStorage["name"] = JSON.stringify(arr);

How to check if John existed in the localstorage? What to do next after I got the values?

JSON.parse(localStorage["name"]);
guest271314

return-false-if-array-exist-in-localstorage

JSON.parse(localStorage["name"]).indexOf("John") !== -1 ? false : true;

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

Why does mongoose model's hasOwnProperty return false when property does exist?

分類Dev

onkeypress = "return false;" onpaste = "return false;"

分類Dev

.isAfter return false

分類Dev

Why does this return False

分類Dev

store array into localstorage instead of replace

分類Dev

Why does false && (false)?false:true return true

分類Dev

click to return false, click again to return true

分類Dev

return nil vs return false in Ruby

分類Dev

stripos return false on number comparison

分類Dev

if (stdout=="E") always return false

分類Dev

Return only true or false (PHP)

分類Dev

Add an array of strings in localStorage without escape characters

分類Dev

Check if data in an array exist in a sheet

分類Dev

ActiveModelSerializer: return object of nils if association does not exist

分類Dev

Treenode exist but treenode.nodes.ContainsKey("Nodename") equals false

分類Dev

Mongoose select:false an array of ObjectIds

分類Dev

in_array always returns false

分類Dev

なぜ `return x == 5?true:false; `?

分類Dev

How to use a DialogFragment to return either true or false?

分類Dev

SQL-If Max Return'True 'Else'False'

分類Dev

Incorrect conclusion that "This condition will always return 'false'"

分類Dev

SQL: return true/false if a related record is presented

分類Dev

Return False with Alert upon webflow form submission

分類Dev

Why Laravel Auth::check always return false?

分類Dev

Can grep return true/false or are there alternative methods

分類Dev

Setting up variable to return function value or false

分類Dev

Django Truncate, return false if no truncation occurs?

分類Dev

svgpanzoom: beforeZoom on return false doesn't halt

分類Dev

Return array as interface

Related 関連記事

ホットタグ

アーカイブ