<commit_before>// Your GuessingGame class should be initialized with an integer called answer.

// Define an instance method GuessingGame#guess which takes an integer called guess as its input. guess should return the symbol :high if the guess is larger than the answer, :correct if the guess is equal to the answer, and :low if theguess is lower than the answer.

// Define an instance method GuessingGame#solved? which returns true if the most recent guess was correct and false otherwise.

// In this case, we're asking you to use symbols for :low, :high, and :correct. This is partly due to the way strings and symbols are stored in memory.


// Pseudocode:
// create an object called answer

// create a function called GuessingGame with the argument guess
// guess should take an integer as its input
// guess should return high if the guess is higher than the answer
// guess should return correct if the guess is equal to the answer
// guess should return low if the guess is lower than the answer

// create a function called solved that returns true if the guess is equal to the answer in the function guessingGame.

// Initial Solution


// function guessingGame(guess, answer)  {
//   if (guess == answer) {
//     console.log("Correct");
//     console.log(solved())
//    }  else if (guess > answer) {
//     console.log("Too high!");
//   } else {
//      console.log("Too low!");
//  };
// };

// function solved() {
//   return true
// }

// guessingGame(7, 7);


// Refactored

function guessingGame(guess, answer)  {
  if (guess == answer) {
    console.log("Correct");
    console.log(solved())
   } (guess > answer) ? "Too high!" : "Too low!";<commit_msg>ruby convert to JS review<commit_after>// Your GuessingGame class should be initialized with an integer called answer.

// Define an instance method GuessingGame#guess which takes an integer called guess as its input. guess should return the symbol :high if the guess is larger than the answer, :correct if the guess is equal to the answer, and :low if theguess is lower than the answer.

// Define an instance method GuessingGame#solved? which returns true if the most recent guess was correct and false otherwise.

// In this case, we're asking you to use symbols for :low, :high, and :correct. This is partly due to the way strings and symbols are stored in memory.


// Pseudocode:
// create an object called answer

// create a function called GuessingGame with the argument guess
// guess should take an integer as its input
// guess should return high if the guess is higher than the answer
// guess should return correct if the guess is equal to the answer
// guess should return low if the guess is lower than the answer

// create a function called solved that returns true if the guess is equal to the answer in the function guessingGame.

// Initial Solution


// function guessingGame(guess, answer)  {
//   if (guess == answer) {
//     console.log("Correct");
//     console.log(solved())
//    }  else if (guess > answer) {
//     console.log("Too high!");
//   } else {
//      console.log("Too low!");
//  };
// };

// function solved() {
//   return true
// }

// guessingGame(7, 7);


// Refactored

function guessingGame(guess, answer)  {
  if (guess == answer) {
    console.log("Correct");
    console.log(solved());
   } (guess > answer) ? "Too high!" : "Too low!";
{'fraction_non_alphanumeric': 0.10014858841010402, 'fraction_numerical': 0.001188707280832095, 'mean_word_length': 3.2339622641509433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7510833', 'n_tokens_mistral': 932, 'n_tokens_neox': 895, 'n_words': 449}