Changes implemented as per the comments

1. Indentation is proper
2. Inser checks.
3. redix is used in parseInt function.
4. javascript is written in separate file.