trying to realise js version of fibonacci in the most efficient way