Default values for function parameters function xhr(method = 'GET') { return method; } xhr(); // => 'GET xhr('POST'); // => 'POST'