Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var dave, jason, nick, get;
- get = prompt('Input your Name', 'Name Here')
- var Person = function (name, birthYear, job) {
- this.name = name;
- this.birthYear = birthYear;
- this.job = job;
- };
- dave = new Person('Dave', 1976, 'Carnie');
- jason = new Person('Jason', 1987, 'Novice');
- nick = new Person('Nick', 1993, 'Cable-tech');
- function printObj(object) {
- var output = '';
- for (var property in object) {
- output += property + ': ' + object[property] + '\n';
- }
- alert(output);
- }
- if (get.toLowerCase === 'dave'.toLowerCase) {
- printObj(dave);
- } else if (get.toLowerCase === 'jason'.toLowerCase) {
- printObj(jason);
- } else if (get.toLowerCase === 'nick'.toLowerCase) {
- printObj(nick);
- } else {
- alert('Not a defined object')
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement