Skip to content

Instantly share code, notes, and snippets.

@desoga10
Last active April 9, 2019 00:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save desoga10/94dc80321bf94c971a9697709075f81c to your computer and use it in GitHub Desktop.
Save desoga10/94dc80321bf94c971a9697709075f81c to your computer and use it in GitHub Desktop.
Display Data into The Console
//Player Register Class
class Player {
constructor(firstname, lastname, residence, position, country, jerseynumber) {
this.firstname = firstname;
this.lastname = lastname;
this.residence = residence;
this.position = position;
this.country = country;
this.jerseynumber = jerseynumber;
}
}
//Register a New Player
document.querySelector('#player-form').addEventListener('submit', e => {
//Prevent Default Submission
e.preventDefault();
//Get The Values of The Form
const firstname = document.querySelector('#firstname').value;
const lastname = document.querySelector('#lastname').value;
const residence = document.querySelector('#residence').value;
const position = document.querySelector('#position').value;
const country = document.querySelector('#country').value;
const jerseynumber = document.querySelector('#jersey').value;
//Instantiate Player Register Class
const player = new Player(
firstname,
lastname,
residence,
position,
country,
jerseynumber
);
console.log(player);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment