Category Archives: Coding


Interview Questions : HTML

  • Can you place more than one <main> tags in your webpage

    Yes, this is possible and valid to put more than one main tag if content of your main tag is not clubbed with another main tag in a single view.

  • What would happen if DOCTYPE is not mentioned in your HTML document

    Though your page would render, but you would face problem in markup validation, and browser may choose to use Quirks Mode. This may also affect the way CSS renders.

Photo of the software code showing the user authentification part. The photo has various uses representing the cyber crime and other security related stuff and hacking the computer systems.

Javascript : Code review checklist

This is a basic list of items to check in your code or your team mate’s code for a simple project involving plain javascript or jQuery. This is not a complete list and some of the points may not be applicable in your project as well.

  1. Right file or module for the intended code
  2. Proper indentation is applied
  3. Variables are not put at root scope or there are no implicit variables
  4. There are no unused variables
  5. Semicolons are applied where they are intended.
  6. There are no hardcoded strings
  7. Functions are made pure as far as possible.
  8. Keep the return statement to minimal (possibly only a single one).
  9. All utility methods are well documented.
  10. Proper commenting of the code if something unusual.
  11. Proper commenting of the code if something unusual.
  12. Caching of jQuery selectors if used more than once.
  13. Events should not be attached more than once.
  14. Cyclomatic complexity should be less and not be more than 10 in the worst case.
  15. Callback statements are declared in a separate function.
  16. All ajax data are handled with type check of any available property.
  17. JQuery operations are chained where ever possible.
  18. Similar jQuery operations are combined.
  19. Make sure there are no more than two level of event target delegation in case of binding events.
  20. Avoid event binding on document load which are based on another event.
  21. Apply event name spacing where ever required.
  22. Avoid wild card jQuery selectors. Prefer to be inside a scope of a component.
  23. Clean any function without body – remove them altogether.
  24. Follow consistent naming convention.
  25. Avoid too much shortening of code ( one liners).
  26. Remove console.log after debugging is complete.
  27. Where ever logging is required, make sure to do that by single global method with meaningful information.
  28. Avoid jQuery selectors by attributes – they are 100 times slower
  29. Make your code as flat as possible. Nested code is difficult to comprehend and debug.
  30. Avoid $.each where ever possible.
  31. Split the JS into logical meaningful files, if it contains so much of code.
  32. Keep the declaration and execution of functions in different scope block.
  33. Method names should be small, self-describing and non-confusing. Avoid names like : doThat()
  34. Utility methods should be pure functions.
  35. Cache long object chains in variables to improve performance.
  36. Avoid applying style in Javascript, make use of classes.
  37. Avoid id selectors wherever possible.
  38. Avoid names/ids/class names like myDiv, test – give a meaningful name.
  39. Prefer design patterns rather than arbitary way.
  40. Make sure to lint your files ( add JSHint plugin to your editor)
  41. Avoid unnecessary variables