素晴らしい文字列リテラルの嵐です!
if(something) {
if (document.getElementById(`${y}` + "_" + `${x}`).children.length !== 0) {
document.getElementById(`${y}` + "_" + `${x}`).removeChild(document.getElementById(`${y}` + "_" + `${x}`).firstElementChild);
};
document.getElementById(`${y}` + "_" + `${x}`).appendChild(html_img);
document.getElementById(`${y}` + "_" + `${x}`).addEventListener("click", move_piece, false);
}
else {
if (document.getElementById(`${y}` + "_" + `${x}`).children.length !== 0) {
document.getElementById(`${y}` + "_" + `${x}`).removeChild(document.getElementById(`${y}` + "_" + `${x}`).firstElementChild);
};
document.getElementById(`${y}` + "_" + `${x}`).addEventListener("click", move_piece, false);
if (document.getElementById(`${y}` + "_" + `${x}`).classList.contains("enemy")) {
document.getElementById(`${y}` + "_" + `${x}`).firstElementChild.classList.remove("enemy")
};
};
使い方ヒント: 「これは臭う」という行を見付けたら、各行の
をクリックしてマーキングしておきましょう(要Twitter OAuth認証)
まだコメントがありません。最初にコメントを残しませんか?
コメント投稿には、twitter認証が必要です。
Twitter認証