javascript - In the parameter description in the js document, get(url[, config]) or get(url,[config]) will appear. What is the difference?
怪我咯
怪我咯 2017-05-19 10:42:06
0
1
659

For example, in the axios documentation

axios#get(url[, config])

axios#delete(url[, config])

axios#head(url[, config])

get(url[,config]) The config parameter indicates optional
get(url,[config]) This config also indicates optional, both are What's the difference? How to write the comma inside
and the comma behind it:
jquery:
hover([over,]out) and hover([over] ,out) What’s the difference?
This kind of comma is at the end, and the square brackets also indicate optional
Where is this syntax or writing specification defined? How can I find this way of writing? What about the description

怪我咯
怪我咯

走同样的路,发现不同的人生

reply all(1)
Peter_Zhu

I haven’t read the documentation of axios.

My understanding is:
get(url[, config])This representation can write two parameters or one parameter, the latter one is optional; get(url[, config])这种表示可以写两个参数或一个参数,后一个是可选的;
get(url,[config])这种表示必须写两个参数,后一个config虽然可选,但是没有的时候要传null;
hover([over,]out)这种表示你写两个参数的时候分别作为over和out传进函数,而如果只有一个参数那就是out;
hover([over],out)get(url,[ config])This representation must write two parameters. Although the latter config is optional, null must be passed if it is not available;

hover([over,]out)This representation When you write two parameters, pass them into the function as over and out respectively, and if there is only one parameter, it is out;

hover([over],out) The meaning is the same as above: it must be passed when there is no over Enter null;

🎜Nowadays, most plug-ins can recognize the number of parameters, so it seems that there are very few cases where commas are written outside and null placeholders need to be passed. 🎜
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!