Ad
Code
Diff
  • const numMinusSeven = num => num - 7;
    • const numMinusSeven = function(num) {
    • return num - 7;
    • }
    • const numMinusSeven = num => num - 7;
Code
Diff
  • const numMinusSeven = function(num) {
      let youGoodBro = [];
      while (num > 0) {
        num -= 7;
        youGoodBro.push(num);
      }
      return youGoodBro.length;
    }
    • function numMinusSeven(num) {
    • let youGoodBro = []
    • while (num > 0) {
    • num -= 7
    • youGoodBro.push(num)
    • }
    • return youGoodBro.length
    • const numMinusSeven = function(num) {
    • let youGoodBro = [];
    • while (num > 0) {
    • num -= 7;
    • youGoodBro.push(num);
    • }
    • return youGoodBro.length;
    • }
Code
Diff
  • function numMinusSeven(num) {
        let youGoodBro = []
        while (num > 0) {
            num -= 7
            youGoodBro.push(num)
        }
        return youGoodBro.length
    }
    • function numMinusSeven(num) {
    • let bbbbbbbbbb = []
    • let youGoodBro = []
    • while (num > 0) {
    • num -= 7
    • bbbbbbbbbb.push(num)
    • youGoodBro.push(num)
    • }
    • return bbbbbbbbbb.length
    • }
    • return youGoodBro.length
    • }
Code
Diff
  • const reverseStr = str => str.split.split('').reverse().join('');
    • const reverseStr = function(str) {
    • return str.split('').reverse().join('');
    • };
    • const reverseStr = str => str.split.split('').reverse().join('');
Code
Diff
  • const solution = s => {
      let total = 0;
      for (let i = 0; i < s.length; i++) {
        if (i < s.length - 1 && romanMap[s[i]] < romanMap[s[i + 1]]) {
          total += romanMap[s[i + 1]] - romanMap[s[i]];
          i++;
        } else {
          total += romanMap[s[i]];
        }
      }
      return total;
    };
    
    const romanMap = {
        'I': 1,
        'V': 5,
        'X': 10,
        'L': 50,
        'C': 100,
        'D': 500,
        'M': 1000
    };
    • var solution = (s) => {
    • let total = 0;
    • for(let index = 0; index < s.length; index++){
    • if((s.length >= index + 1) && (romanMap[s[index]] < romanMap[s[index + 1]])){
    • total += romanMap[s[index + 1]] - romanMap[s[index]];
    • index ++;
    • } else {
    • total += romanMap[s[index]];
    • }
    • const solution = s => {
    • let total = 0;
    • for (let i = 0; i < s.length; i++) {
    • if (i < s.length - 1 && romanMap[s[i]] < romanMap[s[i + 1]]) {
    • total += romanMap[s[i + 1]] - romanMap[s[i]];
    • i++;
    • } else {
    • total += romanMap[s[i]];
    • }
    • return total;
    • }
    • return total;
    • };
    • const romanMap = {
    • 'I': 1,
    • 'V': 5,
    • 'X': 10,
    • 'L': 50,
    • 'C': 100,
    • 'D': 500,
    • 'M': 1000

cant forget semicolons

Code
Diff
  • var a = 1;
    a = 10;
    • var a = 1;
    • a = 10
    • a = 10;
Code
Diff
  • const getGrade = function(s1, s2, s3) {
      const avg = (s1 + s2 + s3) / 3;
      switch(true) {
          case (avg >= 90):
            return "A";
            break;
          case (avg >= 80):
            return "B";
            break;
          case (avg >= 70):
            return "C";
            break;
          case (avg >= 60):
            return "D";
            break;
          default:
            return "F";
      }
    }
    • function getGrade (s1, s2, s3) {
    • let avg = (s1 + s2 + s3) / 3;
    • if (avg >= 90) {
    • return "A"
    • const getGrade = function(s1, s2, s3) {
    • const avg = (s1 + s2 + s3) / 3;
    • switch(true) {
    • case (avg >= 90):
    • return "A";
    • break;
    • case (avg >= 80):
    • return "B";
    • break;
    • case (avg >= 70):
    • return "C";
    • break;
    • case (avg >= 60):
    • return "D";
    • break;
    • default:
    • return "F";
    • }
    • else if (avg >= 80) {
    • return "B"
    • }
    • else if (avg >= 70) {
    • return "C"
    • }
    • else if (avg >= 60) {
    • return "D"
    • }
    • else {return "F"}
    • }
Code
Diff
  • const reverseGear = word => (str === "") ? "" : reverseString(str.substr(1)) + str.charAt(0);  
    • function reverseGear(word){
    • if (str === "")
    • return "";
    • else
    • return reverseString(str.substr(1)) + str.charAt(0);
    • }
    • const reverseGear = word => (str === "") ? "" : reverseString(str.substr(1)) + str.charAt(0);

Refactored a solution/code snippet

Code
Diff
  • const removeSymbols = str => str.match(/\w| /g).join``;
    • function removeSymbols(str) {
    • return str.match(/\w| /g).join``
    • }
    • const removeSymbols = str => str.match(/\w| /g).join``;