A Pen by A George

Tutorials of (A pen by a george) by A george

<!DOCTYPE html>
<html >
<head>
  <meta charset="UTF-8">
  <title>A Pen by  A George</title>
  
  
  
  
  
</head>

<body>
  <button id="button">Get Name</button>
<p id="name">No name</p>
<p id="users">Test</p>
  <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>

    <script  src="js/index.js"></script>

</body>
</html>
/* Downloaded from https://www.codeseek.co/ */
/* Downloaded from https://www.codeseek.co/ */
var newUser = function() {
  var names = [ 'Thomas',
                'Percy',
                'Toby',
                'George',
                'Henry',
                'Gordon',
                'Spencer',
                'James',
                'Andrew',
                'Stephen',
                'Frank',
                'Edward',
                'Paxton',
                'Rheneas',
                'Peter',
                'Victor',
                'Luke',
                'Winston',
                'Kevin',
                'Merick',
                'Owen',
                'Stanley'];
  
  this.addName = function ( name ) {
    names.push(name);
  };
    
  var getName = function() {
    return names[Math.floor((Math.random() * (names.length)))];
  };
  
  var getAge = function() {
    return Math.floor((Math.random() * (55 - 18 + 1) + 18));
  };
                      
  this.create = function() {
      return {
        firstName: getName(),
        lastName: getName(),
        age: getAge()
      };
    };                    
};

var usr = new newUser();
  
$('#button').on('click', function() {
  $('#name').text(usr.create());
});

This awesome code ( A Pen by A George ) is write by A George, you can se more from this user in the personal repository

You can find the original code on Codepen.io

2018 © A George