1. For the current site.
var clientContext = new SP.ClientContext.get_current();2. For a specific site.var clientContext = new SP.ClientContext('https://sharepointsite');If get_current() throws undefined error then load "sp.js" explicitly. see below code:SP.SOD.executeFunc('sp.js', null, createContextMethod);
createContextMethod(){
var clientContext = new SP.ClientContext.get_current();
}