Deciphering JavaScript code

Hi everyone! My name is Adam and I was wondering how to use the .push function in JavaScript in everyday code? :slightly_smiling_face: :+1:

If you have an array, and you want to add a value to it, you use push.

const arr = [];
const val = 42;

console.log(arr); // []
console.log(arr); // [42]

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.