Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Case Analysis of ES6 function with its own parameters

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "ES6 function with parameters instance analysis". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The ES6 function can have its own parameters

If ES6 supports a function with default parameters, determine the operation of undefined and | |:

Instance (ES6)

Function myFunction (xQuery yellow10) {

/ / y is 10 if not passed or undefined

Return Xeroy

}

MyFunction (0Pol 2) / / output 2

MyFunction (5); / / output the default value of the 15j y parameter

Arguments object

The JavaScript function has a built-in object, arguments object.

The argument object contains an array of parameters for function calls.

In this way you can easily find the value of the largest parameter:

Case study

X=findMax (1pyrum 123 500pint 115pr 44pr 88)

Function findMax () {

Var iMagneMaxially ordered [0]

If (arguments.length

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report