'Javascript: pass variable to arrow function instead of setting harcoded value [closed]
How to replace value 1 by the variable x when setting an onclick function to a td like below:
var sounds = [1, 3, 8, 12];
var x = 123;
mytd.onclick = () => play(sounds[1].toString());
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
