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
Koosha Modabbernia
7,098 PointsWhat goes in the "()" in the toUpperCase or toLowerCase property?
So far I learned, in all command with Parenthesis we put something in it, like console.log() and document.write(). but I don't get what should we put in toUppercase and toLowerCase property, if it's always should be empty why there is Parenthesis in the syntax.
1 Answer
Chyno Deluxe
16,936 PointsThe parenthesis simply states that you are calling a method. Some methods require arguments and others don't.
function noArg() {
alert("nothing here");
}
function twoArgs(arg1, arg2) {
alert("Hello " + arg1 + " my name is " + arg2 + ".");
}
noArg(); //output: nothing here
twoArgs(); //Hello undefined my name is undefined.
twoArgs("Koosha", "Chyno Deluxe"); //Hello Koosha my name is Chyno Deluxe.
I hope this helps.
Robert Richey
Courses Plus Student 16,352 PointsRobert Richey
Courses Plus Student 16,352 PointsAdding to what Chyno said, in the case of
.toUpperCase()and.toLowerCase(), no arguments are passed in. When in doubt, check MDN - it's a great JavaScript reference.