Skip to content

Commit

Permalink
change == to ===
Browse files Browse the repository at this point in the history
  • Loading branch information
SarabjitS committed Nov 5, 2023
1 parent 0a939bc commit f85405c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
26 changes: 13 additions & 13 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ document.addEventListener("click", (e) => {
//Listen for the opening selected
document.addEventListener("click", function (e) {
if (
e.target.dataset.name == "opening1" ||
e.target.dataset.name == "opening2" ||
e.target.dataset.name == "opening3" ||
e.target.dataset.name == "opening4" ||
e.target.dataset.name == "opening5" ||
e.target.dataset.name == "opening6" ||
e.target.dataset.name == "opening7"
e.target.dataset.name === "opening1" ||
e.target.dataset.name === "opening2" ||
e.target.dataset.name === "opening3" ||
e.target.dataset.name === "opening4" ||
e.target.dataset.name === "opening5" ||
e.target.dataset.name === "opening6" ||
e.target.dataset.name === "opening7"
) {
isTestMode = false;
renderBoard();
Expand Down Expand Up @@ -191,7 +191,7 @@ prevBtn.addEventListener("click", function () {
makeTutorialHeading();
}

if (opening.length == 0) {
if (opening.length === 0) {
showDialog("Please select an opening first");
} else {
if (isPlay) {
Expand Down Expand Up @@ -224,7 +224,7 @@ prevBtn.addEventListener("click", function () {
//Listen for play button click
playBtn.addEventListener("click", function () {
isPlay = !isPlay;
if (opening.length == 0) {
if (opening.length === 0) {
showDialog("Please select an opening first");
} else {
if (isPlay) {
Expand All @@ -240,7 +240,7 @@ playBtn.addEventListener("click", function () {
//Listen for test yourself button click
testBtn.addEventListener("click", function () {
//If no opening selected
if (opening.length == 0) {
if (opening.length === 0) {
showDialog("Please select an opening first");
} else {
renderBoard();
Expand Down Expand Up @@ -325,7 +325,7 @@ chessBoard.addEventListener("click", function (e) {
}
if (e.target.closest(".sq")) {
square = e.target.closest(".sq");
if (square.getAttribute("id") == openingDestinationMoves[i]) {
if (square.getAttribute("id") === openingDestinationMoves[i]) {
removeSourceMoveHighlight(i);
moveIndex++;
nextHandler(opening[moveIndex][0], opening[moveIndex][1]);
Expand Down Expand Up @@ -358,7 +358,7 @@ function playBtnHandler() {
nextHandler(opening[moveIndex][0], opening[moveIndex][1]);
playSound();
generateTutorial(opening[moveIndex][2]);
if (moveIndex == opening.length - 1) {
if (moveIndex === opening.length - 1) {
disableButton(nextBtn);
clearInterval(id);
replacePauseToPlay();
Expand Down Expand Up @@ -643,7 +643,7 @@ function buttonsOnTestMode() {
} else {
for (const child of document.querySelector(".btn-group").children) {
// Not including next button and playBtn as there are no moves left
if (child == nextBtn || child == playBtn) {
if (child === nextBtn || child === playBtn) {
continue;
}
enableButton(child);
Expand Down
1 change: 0 additions & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,6 @@ h1 {
border-radius: 0.5rem;
grid-template-columns: repeat(8, 5.25rem);
grid-template-rows: repeat(8, 5.25rem);
overflow: hidden;
box-shadow: var(--shadow-elevation-high);
}

Expand Down

0 comments on commit f85405c

Please sign in to comment.