What is the p variable for in Exercise 13


function Person(name,age) {
  this.name = name;
  this.age = age;
// a function that prints the name of any given person
var printPersonName = function (p) {

var bob = new Person("Bob Smith", 30);

// make a person called me with your name and age
// then use printPersonName to print your name
var me = new Person("Jules V", 22);


p is the function parameter, you could call this anything you like, but this way you can pass instances of your object (bob, me) into your printPersonName function


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.