Update core.js

It can be more shorten in $.each.