Skip to content

Instantly share code, notes, and snippets.

@adamharder
Last active April 13, 2016 19:13
Show Gist options
  • Select an option

  • Save adamharder/67be9f9d9f4aa254fd94686e1759bb8b to your computer and use it in GitHub Desktop.

Select an option

Save adamharder/67be9f9d9f4aa254fd94686e1759bb8b to your computer and use it in GitHub Desktop.

Append an array

// initialize array
var arr = [
    "Hi",
    "Hello",
    "Bonjour"
];

// append new value to the array
arr.push("Hola");

// append multiple values to the array
arr.push("Salut", "Hey");

Get the length of an object

x={1:2, 3:4, 5:6}

python
len(x) -> 3

js
Object.keys(x).length  -> 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment