Skip to content

Commit

Permalink
Update api cross origin
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoziefa committed Apr 26, 2021
1 parent f47889c commit 2f3e968
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const state = {
const setState = (newState = {}) => ((prevState = state) => Object.assign(prevState, newState))();

const getWords = (async () => {
const words = await fetch('https://cors-anywhere.herokuapp.com/https://api.datamuse.com/words?ml=ringing+in+the+ears')
const words = await fetch('https://api.datamuse.com/words?ml=ringing+in+the+ears')
.then(res => res.json())
.then(data => data.map(({ word }) => word));

Expand All @@ -38,7 +38,7 @@ const showNotification = () => {
};

const renderLetter = letter => {
let markup = `<span class="letter">${state.correctLetters.includes(letter) ? letter : ''}</span>`;
const markup = `<span class="letter">${ state.correctLetters.includes(letter) ? letter : '' }</span>`;

elements.wordContainer.insertAdjacentHTML('beforeend', markup);
};
Expand All @@ -51,7 +51,7 @@ const displayWord = () => {

selectedWord.split('').forEach(renderLetter);

let areAllLettersPresent = selectedWord.split('').every(letter => correctLetters.includes(letter));
const areAllLettersPresent = selectedWord.split('').every(letter => correctLetters.includes(letter));

if (areAllLettersPresent) {
setState({ gameDone: true });
Expand Down

0 comments on commit 2f3e968

Please sign in to comment.