The parameter in function


forgive my ignorance! how to ensure the type of parameter?for example,the parameter may be a number or a string,.
the string doesn't need be quoted?? at the same time,when you cite the parameter,the parameter is used immediately?


Hey @kitty_hello,

It's fine with "ignorance". Sometimes explaining is needed. :smiley:

Anyways, parameters are arguments, not numbers or strings. That's why you don't need quotation marks. Here's a link to Codecademy's JS Glossary, and scroll down to where you see the contents of "Functions". That will help you some bit. :smiley:


thank you! it's to say when you call a function,you type the name of the function,and then type the argument in the parentheies(no matter it is a number or a string,if th is a string,you should add the quotation)?
my english is poor,maybe there is some mistake .


Think about it like a test:
You're making a test for school and you need to write the day of the month the test is on, your name, and whether you think you'll get a good grade. You could make that function like this:

var testInfo = function(name,date,gradeExpectance) {
    console.log("Your name is " + name + ", the date is " + date + " and it's " + gradeExpectance + " that you think you'll  get a good grade.");

The function takes in a string (your name), a number (the date) and a boolean (true/false; for gradeExpectance)

Let's call it now:


This will log:

Your name is Seemmetor, the date is 24 and it's true that you think you'll get a good grade.
                ^                    ^            ^              
           String input            Number      Boolean

Strings should always be in quotation marks, but variables, booleans and numbers shouldn't.


thank you,I got it :smiley: