Skip to content

Tag: if-statement

Using HTML and Javascript to make a concrete supplies calculator – Takes a value of both ____m3 and a select option (mpa) to give a total price

This is my first time asking a question on Stack Overflow so apologies if I get something wrong. I am currently building a web calculator for a concrete company. Here are the details of the inputs: There is a form with the following inputs: Input 1: Cubic Meters (m3) Input 2: Strength Input 1 takes a value between 0.1 m3

shorten if conditions in js

I want to shorten the conditions of a javascript if but I don’t know how I can achieve it code: I have the conditions defined in this way: I appreciate any help! 🙂 Answer You can remove all unnecessary parenthesis in your if condition: Other than that, there’s not really a clean, readable way to shorten your code.