completed ifelse.js