THE ODIN PROJECT: FOUNDATIONS - CALCULATOR | PROJECT SOLUTION
Vložit
- čas přidán 27. 08. 2024
- 📚 Join the Waitlist for our next Bootcamp in September - codingdors.com...
👨💻 Learn How to Code with Private Classes - www.codingdors...
💡 Get Our Solutions and an eBook on "The Top Mistakes People Make when Learning How to Code" - www.codingdors...
👨💻 Learn How to Code with Private Classes - www.dorscodingschool.com/coachingplans
❓Having a hard time with CS50, FreeCodeCamp or Odin Project? Practice with our exclusive free coding platform: www.codingdors.com/
🎯 Are You A Coding Expert? Take Our Free Quiz and Find Out - www.dorscodingschool.com/quiz
Thank you for the video, it's very helpful and informational. I noticed that when you try to follow up after a calculation there's a bug or error. Example: if you add 1 + 2 = 3 and then press (+) operator to continue adding to the 3 it instead returns the (+2) from the previous calculation. What I did to solve this is was add "currentValue = previousValue" inside the calculate function at the end of each if statement.
Ex:
if(operator ==="+"){
previousValue += currentValue;
currentValue = previousValue;
}..........
What I think was happening was currentValue wasn't being updated and remained the same every time we pressed any other operator.
Again thank you for these making these videos. They're very valuable.
thanks for sharing. I experienced same bug and your recommendation helped fix it.
thanks man for helping
New to JavaScript I’ve seen many calculators but this one seems more like my logic 😊
appreciate for your effort but I wish you went step by step along side with project explanations on the website.
Thank you for making this video! Your solution helped alot because I was getting really stuck in this project. I learnt a lot of new things as well in the process of doing it too!
Great tutorial. It helps a lot that you explain small important details. I got stuck in my project and this gave me a few good ideas to try again :)
That's amazing!
it is super useful very clean and easy to understand. I've been trying to find other solutions on the internet but they are super complicated and this is exactly what I need
Glad it helped!
This was really good. I wish I had found you before being stuck for three days trying to figure this calculator out. You should make more room on the screen by removing the minimap and making the browser window narrower so that you can make the text MUCH bigger. Indenting by 2 spaces would also help you make it more compact.
Thank you! :)
@@DorsCodingSchool please make the vs code font bigger, so viewers can see it easily. thanks
This is an incredibly helpful and well-done video! Thank you for all that you do!!
Glad it was helpful!
I "fixed" what seemed to be missing (being able to calculate each individual operator, without clicking equal)
I set the initial variables to:
let previousValue = '0'
let operator = '+'
then added calculate within handleOperator:
function handleOperator (op) {
calculate()
operator = op
currentValue = ''
}
why is the operator displayed in the current screen? or, how? i cant seem to understand the logic in the code to how it was able to stay in the current screen before it got moved to the previous screen
We’d love to help you more. Did you know you can join our Discord Group and get help from me and from people around the world that are also learning how to code? dorscodingschool.com/discord
Thanks for this tutorial was pretty useful!... but how can I limit the number of zeros in the calcualtor to just one zero?? and make multiple operations like 1+2-3*1??. Thanks!
We'll take a look!
@@DorsCodingSchool thanks! looking forward to it
can you plz explain this line?
currentValue = previousValue.toString();
While I appreciate these videos since there's a lot to learn and I really like your coding/teaching style. But what would be better is if you follow their instructions and code step by step. I know that would result in longer videos, but people who are willing to learn and are coming from The Odin Project wouldn't mind that. Otherwise it just becomes another video on how to make a calculator.
Thank you for your message. We will try to make it better :)
At 15:43 am I able to just put my Script tag below the body of my HTML file to avoid the AddEventListener for 'DOMContentLoaded' ?
You can try it out, but using the DOMContentLoaded is the best solution ;)
Or linking a javascript to a head tag with a keyword defer?
@@troyjosehipona3251 I just learned this two days ago haha
What platform are you using as your local repository?
VS Code
Excellent video, however there seems to be a gap in the functionality of the calculator- right now this code is unable to string several operations together. Nevertheless, this was an excellent explanation. Cheers!
One way to solve this would be to modify the handle operator function to something like this - *function handleOperator(op){
previousOperator = operator;
operator = op;
if(previousValue != "" && currentValue != ""){
calculate(previousOperator);
};
previousNum = currentNum;
currentNum = "";
}*
Can you explain this more? I'm stuck on this exact problem as well and I can't figure it out.
What did you do to change the font-size 09:35
Found the solution: The last property overrides any previous one so, I just shifted the link of my stylesheet below the bootstrap link element in my html file.
This is a great tutorial, except it does not satisfy the odin project calculator assignment requirements. for example:
"Users should be able to string together several operations and get the right answer, with each pair of numbers being evaluated at a time. For example, 12 + 7 - 5 * 3 = should yield 42."
As this projects stands, the user needs to press the = sign to evaluate each operation.
We should include the ability to evaluate any existing operations while clicking on the operand as well as equal sign.
I've been trying to do this but have come to dead ends with the structure given in this example.
Any advise how to implement the feature without rewriting the entire code?
Did you find a solution for this?
Can you please continue projects of CS50 web programming with python and JavaScript
Soon all the projects will be in our channel :)
By the way, we have a Telegram Group to help people learn how to code and where you can connect with learners from all over the world. Over there you can ask any question about programming and you can easily get your questions answered within 24 hours.
Besides that, you will have access to our membership with more than 400 problems made by us to ease your learning curve and 1 hour of group coaching every month!
Check www.dorscodingschool.com/products
@@DorsCodingSchool thanks ❤️❤️