How to get current user name using JavaScript in Script Editor web part?
Here is the code that worked for me: