Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Working With Numbers The Math Object

Nayoon kim
Nayoon kim
3,098 Points

so like, Math. round (2.2) ,,, so 2.2 is the property here ?

just to make sure

2 Answers

Steven Parker
Steven Parker
231,007 Points

As shown, 2.2 is the argument being passed to the Math.round function.

Erick R
Erick R
5,293 Points

Math is the object while round is the property of the object. So round is a property of Math. Round is also a function that takes a value in its parameter, that value is referred to as an argument. Functions can be properties of Objects just like any regular Object property. For example in an object literal:

 let users = {username:"Steve", pass:"5001", email:"stev01@gmail.com", function() {return this.username + this.email;}};

The object here is users and its properties are username, pass, and email, but it also has a property which is a function that returns username + email.

To access these properties you could use the dot notation or bracket notation. For example:

let currentUser = users.username;

Hopefully this answers any future questions and sorry for the late post! Happy Thanksgiving by the way :D