Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var numbers = [1, 3, 5, 7, 8];
numbers.length = 3; // modify the array length
console.log(numbers); // prints [1, 3, 5], elements 7 and 8 are removed
var osTypes = ['OS X', 'Linux', 'Windows'];
osTypes.length = 5; // creating a sparse array
console.log(osTypes);
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
panzerdppro
0viewers