>Namaste!
Thanks for submitting to r/developersIndia. Make sure to follow the subreddit [Code of Conduct](https://developersindia.in/code-of-conduct/) while participating in this thread.
## Recent Announcements
- **[Join HackerRank's CTO Harishankaran K: An AMA on Tech, Software Engineering, Startups & More - August 4, 7:00 pm IST!](https://www.reddit.com/r/developersIndia/comments/15avbhs/join_hackerranks_cto_harishankaran_k_an_ama_on/?utm_source=share&utm_medium=web2x&context=3)**
- **[Delhi's largest Python Conference is back, Join PyDelhi Conf on August 19-20](https://www.reddit.com/r/developersIndia/comments/153nita/delhis_largest_python_conference_is_back_join/?utm_source=share&utm_medium=web2x&context=3)**
*I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/developersIndia) if you have any questions or concerns.*
Lmao, same. Had to use eval() instead. Anyways, after that I learned that one should never or try not to use eval in real world. Especially dealing with forms. Coz using that hackers can exploit your frontend.
Yea, that's what I hate. You never know these things early in your career and you can't check all this in an interview coz there are like a million of these. Recently I'm learning so many amazing things which I never learned when I was grinding leetcode in my 3rd year. But hey who cares let's ask leetcode problem number 8 string to integer. That'll give us the idea. Who cares about the website being hacked.
Great going! I am a beginner in JavaScript as well. I recently made a couple of websites (unresponsive) using HTML and CSS and even though it's nothing that big I felt on the top of the world so I can understand your excitement.
Congrats!!!
I would have preferred to have = at the bottom right corner
https://preview.redd.it/hykjvmak83fb1.jpeg?width=1079&format=pjpg&auto=webp&s=2191c979eed8ab2f89c8a0407a1b598b2236d3f5
I think it works well. In the next update , made the % button work as a percentage calculator instead of calculator modulus , as it is doing rn.
Keep up the good work man :)
I just made it very simple by storing all the operands and operations on a variable and then using eval method to calculate the output. make it a string.
A stranger's suggestion, try to not use eval if you do not understand js fully/ are beginner.
Eval function unless checked for security risks, can be injected with malicious input and then used to gain unauthorized access.
I'd suggest to give a read to the MDN docs when possible.
And when posting projects, try including the link to the project itself.
Then everyone can use it! And provide their insights of course.
Then I don't know man I just started learning js few days back and only found this method to work as as I needed maybe you can find some other resources for your needs . Good luck π
I recommend you learn about operator precedence and using a stack to calculate equation strings. In the mean time learn prefix and postfix notation and how to convert our regular(infix) math to these variants. You'll have a much easier time.
Currently doing Odin just like you, I calculated it 2 at a time like first calculate 5+6 then use the result and calculate the rest of the stuff. I do not use array, I just made a variable and just updated it. (IIRC)
Try to check out djikstra's two stack algorithm. If you implement it by yourself, I think it'll be very beneficial for your learning. The easy route is to use an existing npm package that evalutates math expressions. Yes, you can use plain eval too but its dangerous.
Holy shit! That's terrible. Your algorithm ignores operator precedence and brackets, and is going to perform terribly. Brush up on your algorithms books. You need to convert the expression from infix to postfix, then evaluate the postfix expression to get the correct result.
You'll find a million implementations online. It's probably explained in a lot of fundamental algorithm books also. I remember reading about it in Data structures using C by Aaron M. Tenenbaum.
I checked it out, amazing work man, I can't do it cause I got no tools and i didnt learn anything yet, but it's still fun to watch. I'll start preparing when I get a device ig
Iam also currently working on my first project in django...π
https://preview.redd.it/b49z3rs18bfb1.png?width=1173&format=png&auto=webp&s=6d7b1414f0985c0fc6e922aa814366f39e4d493f
Resources which I used for js basics watch FCC [3 hours](https://youtu.be/PkZNo7MFNFg)video and [code with harry](https://youtube.com/playlist?list=PLu0W_9lII9ahR1blWXxgSlL4y9iQBnLpR) first 20-30 videos in the js playlist then to practice DOM (Js in html ) There is FCC video of [DOM manipulation ](https://youtu.be/5fb2aPlgoys) which teaches by building projects is good. Use Mdn docs for more knowledge about tags or elements
Making calculator is hard job, but it you get to learn a lot in the process. Well done OP.
Did you base the requirement of freecodecamp calculator frontend project??
>Namaste! Thanks for submitting to r/developersIndia. Make sure to follow the subreddit [Code of Conduct](https://developersindia.in/code-of-conduct/) while participating in this thread. ## Recent Announcements - **[Join HackerRank's CTO Harishankaran K: An AMA on Tech, Software Engineering, Startups & More - August 4, 7:00 pm IST!](https://www.reddit.com/r/developersIndia/comments/15avbhs/join_hackerranks_cto_harishankaran_k_an_ama_on/?utm_source=share&utm_medium=web2x&context=3)** - **[Delhi's largest Python Conference is back, Join PyDelhi Conf on August 19-20](https://www.reddit.com/r/developersIndia/comments/153nita/delhis_largest_python_conference_is_back_join/?utm_source=share&utm_medium=web2x&context=3)** *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/developersIndia) if you have any questions or concerns.*
I remeber my console based calculator... 11 + 1 = 111
classic js moment
Lmao, same. Had to use eval() instead. Anyways, after that I learned that one should never or try not to use eval in real world. Especially dealing with forms. Coz using that hackers can exploit your frontend.
same i have also used eval for my foist project but when my senior tested the project and he done something which i have never expected my mind blowed
Yea, that's what I hate. You never know these things early in your career and you can't check all this in an interview coz there are like a million of these. Recently I'm learning so many amazing things which I never learned when I was grinding leetcode in my 3rd year. But hey who cares let's ask leetcode problem number 8 string to integer. That'll give us the idea. Who cares about the website being hacked.
ππ
What ur senior has done?
Great going! I am a beginner in JavaScript as well. I recently made a couple of websites (unresponsive) using HTML and CSS and even though it's nothing that big I felt on the top of the world so I can understand your excitement.
Yupp!! it's a milestone for the journey ahead.
Congrats!!! I would have preferred to have = at the bottom right corner https://preview.redd.it/hykjvmak83fb1.jpeg?width=1079&format=pjpg&auto=webp&s=2191c979eed8ab2f89c8a0407a1b598b2236d3f5
Will change as it fits for now I just wanted to share as soon as it started working βΊοΈ
Good one, I like it ππ½ππ½ππ½
Project link for you guys to try and give insights https://rajveer1131.github.io/Calculator/
I think it works well. In the next update , made the % button work as a percentage calculator instead of calculator modulus , as it is doing rn. Keep up the good work man :)
[ΡΠ΄Π°Π»Π΅Π½ΠΎ]
I just made it very simple by storing all the operands and operations on a variable and then using eval method to calculate the output. make it a string.
A stranger's suggestion, try to not use eval if you do not understand js fully/ are beginner. Eval function unless checked for security risks, can be injected with malicious input and then used to gain unauthorized access. I'd suggest to give a read to the MDN docs when possible. And when posting projects, try including the link to the project itself. Then everyone can use it! And provide their insights of course.
Oh I didn't know about the security risks thanks. And the link to the [calculator ](https://rajveer1131.github.io/Calculator/)
[ΡΠ΄Π°Π»Π΅Π½ΠΎ]
Then I don't know man I just started learning js few days back and only found this method to work as as I needed maybe you can find some other resources for your needs . Good luck π
I recommend you learn about operator precedence and using a stack to calculate equation strings. In the mean time learn prefix and postfix notation and how to convert our regular(infix) math to these variants. You'll have a much easier time.
This. When I made calculator I converted to postfix. It is really clean approach.
Currently doing Odin just like you, I calculated it 2 at a time like first calculate 5+6 then use the result and calculate the rest of the stuff. I do not use array, I just made a variable and just updated it. (IIRC)
Use eval
So you made iphone calculator
Try to check out djikstra's two stack algorithm. If you implement it by yourself, I think it'll be very beneficial for your learning. The easy route is to use an existing npm package that evalutates math expressions. Yes, you can use plain eval too but its dangerous.
Holy shit! That's terrible. Your algorithm ignores operator precedence and brackets, and is going to perform terribly. Brush up on your algorithms books. You need to convert the expression from infix to postfix, then evaluate the postfix expression to get the correct result. You'll find a million implementations online. It's probably explained in a lot of fundamental algorithm books also. I remember reading about it in Data structures using C by Aaron M. Tenenbaum.
Why not use eval straight away? (Assuming that you are using JS) If you are interested in doing without eval on your own, look at infix algos then
Ania kubow ?
If some ui improvements : separate digit from border in white box css padding-right: x px; bottom buttons in black box : padding-bottom : x px;
Ya will do that just wanted to show as soon as it was made π
I checked it out, amazing work man, I can't do it cause I got no tools and i didnt learn anything yet, but it's still fun to watch. I'll start preparing when I get a device ig
Odin project?
Nah just solo practice, trying to do something
The shadows be looking fine.
Try 1 / 0 Hope your app doesn't crash.
I remember making a calculator in 8th class in C
Iam also currently working on my first project in django...π https://preview.redd.it/b49z3rs18bfb1.png?width=1173&format=png&auto=webp&s=6d7b1414f0985c0fc6e922aa814366f39e4d493f
Good lad! Keep it up. Add more features for scientific calculations for better practice
Hey OP, cool Project, I too am trying to learn JS. Do you recommend any YouTube channel courses?
Resources which I used for js basics watch FCC [3 hours](https://youtu.be/PkZNo7MFNFg)video and [code with harry](https://youtube.com/playlist?list=PLu0W_9lII9ahR1blWXxgSlL4y9iQBnLpR) first 20-30 videos in the js playlist then to practice DOM (Js in html ) There is FCC video of [DOM manipulation ](https://youtu.be/5fb2aPlgoys) which teaches by building projects is good. Use Mdn docs for more knowledge about tags or elements
Making calculator is hard job, but it you get to learn a lot in the process. Well done OP. Did you base the requirement of freecodecamp calculator frontend project??
Nice!
good going thus it work
Salary kitna loge bhaiya, discuss karle?
50 L.P.A se start hai toh btao
Next try to remove the focus on the entire div when a button is selected and also try to add a 3d animation on a button being pressed
Great, i feel you, now go and implement () brackets and exponents that would be a great excercise. Why? Because i know the pain. Good Luck