/ Published in: JavaScript
URL: http://www.startupcto.com/front-end-tech/javascript/optional-parameters-default-arguments
Expand |
Embed | Plain Text
function testFunction(a,b,c) { // this says 'if the type of a is undefined, set it to '', otherwise set it // to a (e.g. itself)' a = (typeof(a) == undefined) ? '' : a; b = (typeof(b) == undefined) ? '' : b; c = (typeof(b) == undefined) ? '' : c; }
You need to login to post a comment.
