Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/2.0.8/es5-shim.min.js"></script>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
 class User {
   id:string = 'qq'
  firstName:string;
  lastName:string;
  constructor() {
    this.id = Math.floor(Math.random() * 6) + 1  
  }
   public toString = () : string => {
        return `Foo (id: ${this.id})`;
    }
  
}
  
let array = new Array(9).fill(new User());
console.log('Array 1' + array);
let array2 = Array.from({length: 9}, () => new User());
console.log('Array 2' + array2);
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers