Is it possible to write a condition if, when the button is pressed, function 1 is played, then name = "Vlad"?

  • 0
    In general there are 3 buttons, each calling a different function. Is it possible to create a condition in which it is written: If function 1 is reproduced, then name = "Vlad", if function 2, then name = "Kirill", well, you get the idea.
    JavaScript Anonymous, Jul 25, 2020

  • 3 Answers
  • 0
    Is it possible to write a condition if function 1 is played when the button is pressed, then name = "Vlad"?


    Yes, it is possible.
    Anonymous

  • 0
    Not sure if you want 3 different functions. It is better to put names in the date attributes of buttons and catch clicks on all buttons in one handler. Because you can click past the button, check if there is a date property on the element that was clicked before assigning a new name. Like this
    Eleanor Floyd

  • 0
    It remains to understand what "function is reproduced " means.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!