Remove null value from map and change access into javascript