Javascript Replace Element In Array Python Example