C Rules Engine Javascript Interviewbit