Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!weretis.net!feeder4.news.weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: quick question: how to dynamically an image source file? Date: Tue, 20 Jan 2015 14:06:13 +0100 Organization: PointedEars Software (PES) Lines: 46 Message-ID: <1894285.eRrXKrdmPT@PointedEars.de> References: <9607d1f5-10c0-4703-901c-bab1932cb04a@googlegroups.com> <6abe327d-c487-4e03-8a6f-f7f65ebc8bb0@googlegroups.com> <14epavonqlnzl.2wklfi1o8grp.dlg@40tude.net> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1421759213 31833 eJwNycEBwCAIA8CVghDSjoMK+4/Q3vfoaXkUyQwOJwjQ8CzvoXJ1WxfgL0v0wnb2XwNI5w4+/hkQiw== (20 Jan 2015 13:06:53 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 20 Jan 2015 13:06:53 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNycEBwEAEBMCWOJYoJ1b0X0JuvgMLDaYHwrFYEQW3ZlNhck95Q05k+1rtsRzvCjmcz9mDZr2QJcfx9A8wPRVa Cancel-Lock: sha1:UrV8c7LKpYQKJFhBRQzCVmu3P9E= X-NNTP-Posting-Host: eJwNxMEBwCAIA8CVJCZgxwFa9h/B3uO03byDLqdGk1aZCKbKXDSkMG+v2k02luk8p1oAvv+4GnMQrA== Xref: csiph.com comp.lang.javascript:26633 JJ wrote: > If you use !b and b is not yet declared, the JavaScript engine will try to > retrieve b variable's value, fail, then stop the execution. This statement does not make a lot of sense. It is only possible to “not yet declare” an identifier when using eval() and not in strict mode. [1] Other declarations in an execution context are processed *before* execution of the statements in that context begins. [2] The “JavaScript engine” (the ECMAScript implementation) will _not_ “try to retrieve b variable's value”; it does not even "know" at this point *whether* the identifier is referring to a variable. Instead, the identifier “b” is resolved. This is done according to the current *scope chain*. If no other object is in the scope chain before it (per the “with” statement in non-strict mode), the Variable Object of the same execution context (ES 1 to 3 Final), or the Variable Declaration Binding (ES 5.x) will be checked against. If no such name can be found there, i. e. the next object in the scope chain does not have a property of that name, lookup will continue along the scope chain until is end is reached, [3] at which usually is the Global Object (not in eval code in strict mode [1]). If the last object in the scope chain still does not have such a property, execution does _not_ simply fail. Instead, a ReferenceError exception is thrown at the line of the originating code [4] which can be caught in the respective execution context and calling execution contexts [5] by a try– catch(–finally) statement [6]. Only if the exception is not caught, execution of the program terminates, returning the exception referred to by “e” as part of the abrupt completion “(throw, e, empty)”. [7] _____________ [1] [2] [3] [4] [5] [6] [7] -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.