Skip to content

Tag: javascript

Best practices for declaring or assigning types

I’m a beginner with TypeScript (Day 1), but have worked on above average JavaScript projects. I’m looking for advice about some “best practices” and standards when it comes to declaring or assigning types in code. At the moment, I find myself doing it for literally everything which is …

Node JS multliple promises chaining

I have node JS api server and I’m having issues with correct chaining of the Promises: What I get in console is : 1 [Object] – all good Emppty Array Empty Array get one doc {object} – all good 1.5 {object} – all good How would I make sure when I loop over result of 1st promise my code …

Hidden password only works in one input box

I have this JS code that shows 2 input boxes that asks for a password: 1) Password 2) Confirm Password. However, the clickShowPassword() is only connected to Password. [Output] [1]: https://i.stack.imgur.com/IZoa3.png Here’s my whole js file that is connected to an react application. Answer In your seco…

Javascript returning SUM 0

Sorry for this basic JS question. I have this code: my value is always 0. I know it’s because let is not changing, but I don’t know why. Could you help me, please? Answer parseInt(‘0.3’) is 0. So one of your values is 0, so the result will always be 0. Try using parseFloat instead.