Replace First Item In Array Javascript Append Function In Prolog