Added elementary JavaScript algorithms