See this?
ourArray.push(["happy", "joy"]);
No Big deal I get it.
But here .push has parens after it. Does that mean it’s a method? And the stuff in the parens are args for the method?
See this?
ourArray.push(["happy", "joy"]);
No Big deal I get it.
But here .push has parens after it. Does that mean it’s a method? And the stuff in the parens are args for the method?
The push() method adds one or more elements to the end of an array and returns the new length of the array.
var numbers = [1, 2, 3];
numbers.push(4);
console.log(numbers); // [1, 2, 3, 4]
numbers.push(5, 6, 7);
console.log(numbers); // [1, 2, 3, 4, 5, 6, 7]
Found this example here https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push
Yes. .push()
is a method that can be used on JavaScript Arrays and in this example ["happy", "joy"]
is the argument.