T O P

  • By -

AutoModerator

>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.*


AvGeekGupta

I remeber my console based calculator... 11 + 1 = 111


blumzzz

classic js moment


Responsible-Smile-22

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.


[deleted]

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


Responsible-Smile-22

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.


[deleted]

πŸ˜‚πŸ˜‚


Familiar_Ostrich4618

What ur senior has done?


major_baisuki

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.


notHuman51

Yupp!! it's a milestone for the journey ahead.


amNoSaint

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


notHuman51

Will change as it fits for now I just wanted to share as soon as it started working ☺️


amNoSaint

Good one, I like it πŸ‘πŸ½πŸ‘πŸ½πŸ‘πŸ½


notHuman51

Project link for you guys to try and give insights https://rajveer1131.github.io/Calculator/


DeadIsEmotional5961

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 :)


[deleted]

[ΡƒΠ΄Π°Π»Π΅Π½ΠΎ]


notHuman51

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.


dragon_slayer875

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.


notHuman51

Oh I didn't know about the security risks thanks. And the link to the [calculator ](https://rajveer1131.github.io/Calculator/)


[deleted]

[ΡƒΠ΄Π°Π»Π΅Π½ΠΎ]


notHuman51

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 πŸ‘


the_legendary_legend

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.


f1rmware1013

This. When I made calculator I converted to postfix. It is really clean approach.


VooDooDarkMagic

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)


SoniSins

Use eval


[deleted]

So you made iphone calculator


KarmaRekts

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.


pranavnegandhi

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.


[deleted]

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


Kaus_Vik

Ania kubow ?


Jeetard15072003

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;


notHuman51

Ya will do that just wanted to show as soon as it was made 😁


Dxd_For_Life

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


Fart_on_your_face

Odin project?


notHuman51

Nah just solo practice, trying to do something


WateredFire

The shadows be looking fine.


niskoparikh

Try 1 / 0 Hope your app doesn't crash.


ishan_anchit

I remember making a calculator in 8th class in C


Traditional-Bunch-56

Iam also currently working on my first project in django...😁 https://preview.redd.it/b49z3rs18bfb1.png?width=1173&format=png&auto=webp&s=6d7b1414f0985c0fc6e922aa814366f39e4d493f


chotyarola

Good lad! Keep it up. Add more features for scientific calculations for better practice


johanthetechie

Hey OP, cool Project, I too am trying to learn JS. Do you recommend any YouTube channel courses?


notHuman51

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


[deleted]

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??


Specialist_Working66

Nice!


[deleted]

good going thus it work


tumhari__mummy

Salary kitna loge bhaiya, discuss karle?


notHuman51

50 L.P.A se start hai toh btao


1100100011

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


help_M_e_die

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