need to rewrite spriral in js