hey am trying to write a JavaScript simple game program, my program has two players 1 and 2, i want to write a statement trying to say that "if it is turn for player , add a hidden class to a certain element, and execute some conditions. and if it is player 2 turn, do the same". Yes i know one way of doing it but it is quite long and i wanna try it this way but am getting an error, what can i do. Below is part of my code.
"using strict";
const PLAYER_1_ELEMENT = document.querySelector(".player-1");
const PLAYER_2_ELEMENT = document.querySelector(".player-2");
const TOTAL_1_ELEMENT = document.querySelector(".total-1");
const TOTAL_2_ELEMENT = document.querySelector(".total-2");
const BTN_TRY_LUCK = document.querySelector(".top");
const BTN_RESET_LUCK = document.querySelector(".bottom");
const CURRENT_1_ELEMENT = document.querySelector(".borders-1");
const CURRENT_2_ELEMENT = document.querySelector(".borders-2");
const IMAGES_1 = document.querySelector(".images-1");
const IMAGES_2 = document.querySelector(".images-2")
let player = [1,2];
//statement giving me errors
IMAGES_${player[1]}.classList.add("hidden");
//below are the conditions i want it to execute
if(IMAGES_${player[1]}.classList.contains(".active")) {
//...................
//..................
}