basic Javascript algorithms for coding dojo