Numbering for the pins

What is the difference in numbering for the pins when we use the tag and when we use the read and write javascript functions, this causes a lot of errors in the code.

@kandhari78 Please type your code.
To type code first paste in the text box. After pasting the code select all the code and click on </> from formatting list.