javascript - Explanation of Code - I think it's Lambda expression -
it's been long since have been programmer ask stupid questions. have not new techniques make me pretty old fashioned programmer. example following code, remove cookies.
var cookies = document.cookie.split(';'); (var = 0; < cookies.length; i++) { var cookie = cookies[i]; var eqpos = cookie.indexof('='); var name = eqpos > -1 ? cookie.substr(0, eqpos) : cookie; document.cookie = name + '=;expires=thu, 01 jan 1970 00:00:00 gmt'; }
in there doing this
eqpos > -1 ? cookie.substr(0, eqpos) : cookie;
i don't know happening here. please explain. , type of notation , need learn understand it.
it short if statment, condition
eqpos > -1
name be:
cookie.substr(0, eqpos)
if condition true:
and
cookie
if false
Comments
Post a Comment