function connect(hostname, port, method) {
if (hostname === undefined) hostname = "localhost";
if (port === undefined) port = 80;
if (method === undefined) method = "HTTP";
}
However, there’s a prettier shortcut:
function connect(hostname, port, method) {
hostname = hostname || "localhost";
port = port || 80;
method = method || "GET";
}
No comments:
Post a Comment