Enthalpy change for exothermic and endothermic reactions
According to the definition, 
 Enthalpy = Enthalpy(products) - Enthalpy(reactants), this should be followed.

When you are saying that 40 J are used up it means that 40 J are used in transforming the reactants to an activated complex(reaction intermediate) and when you say that 50J are released then it means that 50J is liberated when this activated complex is transformed to the product.

Assume that the energy of the activated complex be 0, then the energy of the reactant must be -40J(because 40J are required to convert reactant to the activated complex) , and the energy of the products should be -50J( because energy is released in converting the complex to the product)

Enthalpy(products)=-50J

Enthalpy(reactants)=-40J

Therefore,
 Enthalpy = (-50)-(-40) J = -10J.