Created
December 21, 2017 20:07
-
-
Save mishrsud/8e85f064509b22d79360ea9ca6989f64 to your computer and use it in GitHub Desktop.
JavaScript array of arrays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function arrayTest() { | |
var array = [ | |
[1234, "123123-132131-ejwh213", "comment 1234 | comment 2345"], | |
[1235, "123124-132132-ejwh214", "comment 3 | comment 32"], | |
[1236, "1231235132133-ejwh215", "comment 4 | comment 5"]]; | |
var theArray = array.find(function (el) { | |
return el.indexOf("1231235132133-ejwh215") > -1; | |
}); | |
var comments = theArray[2].split('|'); | |
console.log(theArray); | |
console.log(comments); | |
comments.forEach(function (element) { | |
if (element.indexOf("4") > 0) { | |
console.log("found " + element); | |
} | |
}); | |
} | |
arrayTest(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment