Created
June 23, 2021 14:46
-
-
Save Park-Developer/634e2a7b76c53dd5d4a4699c88bc8048 to your computer and use it in GitHub Desktop.
object in array
This file contains 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
var arr = []; | |
for(i=1; i<11; i++){ | |
var keyName = "count"+i | |
var count = Math.floor(Math.random()*1000); | |
var obj = new Object(); | |
obj[keyName] = count; | |
arr.push(obj); | |
} | |
arr.forEach(function(value){ | |
console.log(value); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment