Angular Loop Over Array Javascript Append Function In Prolog