adampaulsackfield / calculator

A calculator built for Nology using pure HTML, CSS & JavaScript.
GNU General Public License v3.0
2 stars 0 forks source link

Feedback #29

Closed Charlie-robin closed 1 year ago

Charlie-robin commented 1 year ago

Feedback

Requirements

Lets Build

Score

MARKING-SCHEME

Category Score
Version Control 10 / 10
Site Output 45 / 45
Readability 20 / 20
Responsiveness 10 / 10
Code Knowledge & Use 25 / 25
Total Score 110 / 110

Feedback

The UI

Positive

Constructive

The Code

Positive

Constructive

// functions.js

// LINES 86 - 91
const handlePercent = () => {
  const { currentInput } = getState();

  const ans = +currentInput / 100;
  showAnswer(ans);
};

// LINES 115 - 124
const handleExponent = e => {
  const { currentInput } = getState();

  const operator = e.target.innerText;

  const answer = operatorMap[operator](currentInput);

  showAnswer(answer);
};
// convertToPostfix.js

// LINES 10 - 11
let output = [];
let stack = [];
// maps.js

const precedenceMap = {
  "+": 1,
  "-": 1,
  "*": 2,
  "/": 2,
  "(": 0,
  ")": 0,
  hasPrecedence: function (a, b) {
    return this[a] <= this[b];
  },
};
// convertToPostfix.js

// LINES 16 - 18
while (stack.length && stack[stack.length - 1] !== "(" && precedenceMap.hasPrecedence(char, stack[stack.length - 1])) {
  output.push(stack.pop());
}

adampaulsackfield commented 1 year ago

@Charlie-robin Thanks for the feedback, I am stoked to get full marks and I really enjoyed this project. Some really nice comments in here and I am very happy.

Some really good feedback here on the constructive side, I particularly liked the refactoring of the precedenceMap to include the logic.

I have implemented every change you have listed here, Cypress is still passing so that good and I added another test case for the bug you found, now if you do 5 + 5 = you'll get 10 and then I store this as the next number, disabled numbers so that only operator can be used.

Really appreciate the link to that codepen and appeciate you taking the time to make it, I have now implemented this for the toggle here and I must say its way easier now. I also tweaked the colors on the light mode as you said they didn;t stand out too much.

All style tweaks have been implemented, lets changed to const where needed and destructuring in logical places.

Per your second bullet point - I do intend going over board with future projects - see Snake :)

Charlie-robin commented 1 year ago

@adampaulsackfield That is good to hear and you deserved all of them, probably more šŸ‘ .

Good, I am glad you added it, to me it made sense to add it to the object. I am stoked you have managed to do all the tweaks as well so quickly.

Yeah of course I look forward to looking at snake, there probably will be a little bit of a delay to give you detailed feedback šŸ˜ .