I created a SharePoint Add-in for SharePoint Online by Visual Studio 2017 This is App.js:
function initializePage() { var context = SP.ClientContext.get_c