Created
February 17, 2015 02:53
-
-
Save uptownhr/7055f7ef988a4ec9f244 to your computer and use it in GitHub Desktop.
js array filter clone
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
| File Edit Options Buffers Tools Javascript Help | |
| var test =[{a:1},{a:2},{a:3}]; | |
| exist = test.filter( function(itme){ | |
| return itme.a == 3 | |
| }) | |
| console.log(exist) //outputs a:3 | |
| exist.a = 99; | |
| console.log(test); //outputs a:1, a:2, a:3 | |
| test.forEach( function(item){ | |
| item.a = 99; | |
| }) | |
| console.log(test); //outputs a:99, a:99, a:99 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment