How to put the last argument into the function



  • All I want to do is change the last argument to function, search for infu with the operator, until I found nothing. I'll be happy with any help.

    const func = (a = 1, b = 2, c =3) => {
      code
    }
    

    I need to ask you to be 5

    In the end, I want to get it.

    (a = 1, b = 2, c = 5)



  • https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Functions/Default_parameters#%D0%BF%D0%B5%D1%80%D0%B5%D0%B4%D0%B0%D1%87%D0%B0_%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D1%8F_undefined_%D0%B2_%D1%81%D1%80%D0%B0%D0%B2%D0%BD%D0%B5%D0%BD%D0%B8%D0%B8_%D1%81_%D0%BF%D0%B5%D1%80%D0%B5%D0%B4%D0%B0%D1%87%D0%B5%D0%B9_%D0%B4%D1%80%D1%83%D0%B3%D0%B8%D1%85_%D0%BB%D0%BE%D0%B6%D0%BD%D1%8B%D1%85_%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B9

    function func(a = 1, b = 2, c =3){
      console.log(a , b , c)
    }
    

    func(undefined,undefined,4)


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2