Tag:Function parameters

  • Using arrays as function parameters

    Time:2020-11-17

    We all know that variables can be used as parameters of functions, Every element in the array is also a variable, so we canUse array elements as function parameters。 In addition, useArray names can also be used as arguments and formal parameters, passing the array’sFirst address。   1、 Using array elements as function arguments This […]

  • The bridge between callback and promise — promise

    Time:2020-11-12

    Author: Huang HuangThis article is original and reprinted, please indicate the author and source Promise has been widely used since it came into being. It’s a magic tool in JavaScript. It solves the callback hell of asynchronous methods, provides us with the ability to use return in asynchronous methods, and integrates the call of callback […]

  • A promise

    Time:2020-10-21

    A little understanding Promise is another way to write asynchronism. In my humble opinion, promise is a kind of encapsulation of callback Compared with callback, it has the following characteristics Promise saves asynchronous results and can be obtained at any time A chained call to the then method returns a new promise, avoiding a callback […]

  • 10 tips for JavaScript developers

    Time:2020-9-1

    You may miss these very useful techniques. Translated from 10 super useful tricks for JavaScript developers, written by mahdhi rezvi. We know that JavaScript is developing at a high speed. Along with es2020, there are a lot of great features added. To be honest, you can write code in many different ways. To achieve the […]

  • Use react setstate in this way to develop a direct call expert!

    Time:2020-8-23

    (Long time no see, title skin, content or conscience)As we all know, react realizes the management of components by managing the state, and setstate is the most basic method for changing the state. Although it is basic, it is not easy to master. This paper will make a relatively in-depth analysis of this method combined […]

  • Some key points of Python programming specification

    Time:2020-7-29

    Some key points of Python programming specification: Dictionary read, use dict_ name.get (key) type method If the function parameter passes an instance, isinstance should be used in the function for parameter detection instead of type Do not use return or break statements in finally When the function parameter is variable, do not use the default […]

  • Add default values to Python function parameters

    Time:2020-7-24

    Like C + +, python supports function definition with default values. However, the parameters with default values need to be placed after the function parameters. Otherwise, an error will be reported when calling, indicating that the parameters without default values are not assigned. In Python language, the asterisk (*) can be used to design a […]

  • How to use array as function parameter in shell

    Time:2020-6-6

    Because of the need of work, we need to use shell to develop some small tools. When we use array as a function parameter, we find that only the first element of the array can be passed, and the elements behind the array cannot be passed into the function. #!/bin/bash function showArr(){ arr=$1 for i […]