A very fast question that i cant understand


why do we write "p" in p.name and in function(p) and how does "p" become bob, is p a placeholder of some sorts and why dont we have to declare it as a variable

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);


@codesmax you're right, p is a placeholder for whatever parameter is passed into the function when it's called. You're sending bob as a variable into the printPersonName function, and the function stores that variable in p. You don't have to declare p as a variable because it's only used as a placeholder for the function, so it's inheriting a value from the parameter you passed it, rather than being assigned a value on its own.

hope that makes sense!


very good its what i expected thank you for your help clearing my brain
@freginold and also after javascript what language should i learn maybe angularJS?


@codesmax it depends what you want to do with JavaScript, but AngularJS would be great to know.


@freginold My main reson to learn programming is to create a game on my android phone, any ideas?


AngularJS would be good, it lets you do more with JavaScript and create your own HTML tags. the Codecademy AngularJS course is a good start, but it glosses over some of the basic aspects, so you might want to supplement it with another tutorial or course.


Do you recomend any?
+what app/program should i download to write code for example now that i have finished the JS course where can i create my game on?


I haven't tried any other AngularJS courses yet, so I can't recommend any. As for a program to download, Komodo Edit is a great one. It has auto-complete, lots of cool features, and supports many different languages (HTML, JS, CSS, Python, and much more).


For text editor to write in, i like to use "Sublime Text 2", the reason i like that is because of the collor coding and such. Makes it easy to navigate your code and identify areas. Personal prefrence, and i do know others do the same. If money is an issue i would look for a free one. As this one has a price tag of $70.
Hope you find one you like. :slightly_smiling: