In this article, I’ll go through the basics of JavaScript variables and important points, which should be known by SharePoint / Office 365 developers, who use JavaScript Object Model(JSOM) for SharePoint / Office 365 development.
Background While working on one of my SharePoint online projects, I realized that its not sufficient only to know the SharePoint and respective SDKs. Nowadays, in the development of SharePoint / Office 365, the importance of JavaScript is increased a lot, in order to avoid custom Server side coding, that sand box solutions are deprecated, new App model development, performance, and that migration becomes easy etc. One important scenario which I found is we have added two JSOM Web parts (content editor with JSOM) on one of our SharePoint online pages and both the Webparts stopped working. When we had only any one Web part on the page, it was working fine but when we have both the Web parts on the page, none of the Web parts were working. After looking into the details, I found that it's a JavaScript issue -- the same variable names in both the Web parts .JS file, JavaScript namespaces are not used, “Strict” keyword is not used etc. Hence, I thought why not share the basics of JavaScript, which SharePoint /Office 365 developers should be aware of. I’ll start with very simple, JavaScript variables (though this is a very important point) and in the coming articles, we move ahead with the advanced topics, which are useful for SharePoint / Office 365 development. JavaScript variables
Here, I tried to cover all the required details regarding JavaScript variables. If you think of any more important points which I missed here, please include in the comments section.
SharePoint 2016 Document Libraries - End User Training Manual