Inspiration

Chemistry class

What it does

right now, it can take the mass of water and calculate the masses of O2 and H2.

How I built it

I created variables for each element used. using different functions of the variable, I can find the amount of moles.

Challenges I ran into

I'm trying to cut the code down, I also want to be able to input chemical equations from a website into the program.

Built With

Share this project:

Updates

posted an update

let sodium = {}; sodium.name = "sodium" sodium.abbr = "Na" sodium.mm = 22.99

let chlorine = {}; chlorine.name = "chlorine" chlorine.abbr = "Cl" chlorine.mm = 35.45

let compound = {}; compound.name = "salt" compound.abbr = "NaCl" compound.mm = 58.44 compound.mass = 10

compound.mole = compound.mass/compound.mm compound.array = [sodium, chlorine, oxygen]

for(var i = 0; i<compound.array.length; i++){ element=compound.array[i] element.mole = compound.mole element.mass = compound.mole*element.mm console.log(compound.array[i]) } This code gives all the information about the amount of sodium and chlorine that go into 10 grams of salt.

Log in or sign up for Devpost to join the conversation.