That's not how interpolation works. It just inserts the value of the expression into a string. For example:
const age = 30
console.log(`I am ${age} years old!`) // Prints "I am 30 years old"
It doesn't interpret a string as an expression, which is what you apparently want to do. You could do that using eval, but this is most likely a step into the wrong direction.
If you want to iterate over the given values, just use an array instead:
function save (values) {
for (const value of values) {
alert(value)
}
}
<input type="button" value="Submit" onclick="save([9, 8, 7])" />
You can also iterate manually over the indexes, that can be useful if you need the index too, for example:
function save (values) {
for (let i = 0; i < values.length; i++) {
alert(`Index ${i} = ${values[i]}`)
}
}
<input type="button" value="Submit" onclick="save([9, 8, 7])" />
Or, if you want to keep your method of calling the function with multiple arguments (although the count argument is completely unnecessary), you can destructure the arguments into an array, like this:
function save (...values) {
for (let i = 0; i < values.length; i++) {
alert(`Index ${i} = ${values[i]}`)
}
}
<input type="button" value="Submit" onclick="save(9, 8, 7)" />
If you really wanted that count argument there, you could use function save (count, ...values). As a side note, there is also arguments, which is an array-like object that holds all the arguments passed to your current function, so you could iterate over that as well.
Id1,Id2, ... but he wants to display the argument values1,2...