Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: Thomas 'PointedEars' Lahn Newsgroups: comp.lang.javascript Subject: Re: Differences between [[Class]] and constructor Date: Tue, 02 Jun 2015 23:07:46 +0200 Organization: PointedEars Software (PES) Lines: 20 Message-ID: <1528792.TAupHRCX4z@PointedEars.de> References: <6733032.WIyCHQfpTH@PointedEars.de> Reply-To: Thomas 'PointedEars' Lahn Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: solani.org 1433279429 31266 eJwFwQkBwDAIADFLZXxFDrCdfwlLXENi08LDHIe7dCI0S75lVz9MydEz9XAGxFcrWy2sf0R7EgI= (2 Jun 2015 21:10:29 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Tue, 2 Jun 2015 21:10:29 +0000 (UTC) User-Agent: KNode/4.14.2 X-User-ID: eJwNy8EBwCAIA8CVQBKQcRRk/xHa+x/N1SvgdHA4dff0XfK2RL0RMWBkQyLROuVRxOnROJFsxTp/rtf0tLz2AV1SFWs= Cancel-Lock: sha1:drWwdeOZliqOkYXbrvNySgo0vkE= X-NNTP-Posting-Host: eJwFwYEBwCAIA7CXENsyzhGR/09Ywq2lGxAFDgeYzeiTNUx//VnYKQNQVEclL3v5WOYLZ/0ZEBDd Xref: csiph.com comp.lang.javascript:27969 Thomas 'PointedEars' Lahn wrote: > Stefan Ram wrote: >> function className( object ) >> { return 0, >> Object.prototype.toString.call( object ). >> replace( "\[object ", "" ).replace( "\]", "" ); } > > This is written shorter, less error-prone, more efficient, and actually > readable > > (({}).toString.call(object).match(/\[object\s+(.+)\s*\]/) || [])[0] [1], of course. (So much for “less error-prone” ;-)) -- PointedEars FAQ: | SVN: Twitter: @PointedEars2 | ES Matrix: Please do not cc me. / Bitte keine Kopien per E-Mail.