Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #28012
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Newsgroups | comp.lang.javascript |
| Subject | Re: Make own type (object) type in javascript. |
| Supersedes | <1780528.P01b5vAQSM@PointedEars.de> |
| Date | Sun, 07 Jun 2015 02:40:27 +0200 |
| Organization | PointedEars Software (PES) |
| Lines | 28 |
| Message-ID | <2283260.pclIp03G5q@PointedEars.de> (permalink) |
| References | <66362d49-af1e-400b-b026-0e6d9b679f98@googlegroups.com> <87iob0l79e.fsf@bsb.me.uk> |
| Reply-To | Thomas 'PointedEars' Lahn <cljs@PointedEars.de> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset="ISO-8859-1" |
| Content-Transfer-Encoding | 7Bit |
| X-Trace | solani.org 1433637789 8507 eJwFwQERADEIAzBL7CgtyAH28y/hk3AersAg4sUz2amGTa+yMxDyJNRbM4ksbynRXOK7e38E7RC0 (7 Jun 2015 00:43:09 GMT) |
| X-Complaints-To | abuse@news.solani.org |
| NNTP-Posting-Date | Sun, 7 Jun 2015 00:43:09 +0000 (UTC) |
| User-Agent | KNode/4.14.2 |
| Cancel-Key | sha1:g0ZjFX3AFTZ6QuYR+sFStVqEjes= |
| X-User-ID | eJwFwQkBwDAIA0BLhK8gpx3Bv4TdhSXyO56RHhvL9iGoyNI+e+HKZ01KCHDHxFpL3htUljQIWIttNYeOHz2WFJw= |
| Cancel-Lock | sha1:OS9KJKo/lbsMSk+jshP345MUEtY= |
| X-NNTP-Posting-Host | eJwFwYEBwCAIA7CXoNCq5zCU/09YwpCrV4pKDkd5Ksa+jeDlBBtz4as8yYyqfpANnhn6+P4BEMkQjQ== |
| Xref | csiph.com comp.lang.javascript:28012 |
Show key headers only | View raw
Ben Bacarisse wrote:
> jonas.thornvall@gmail.com writes:
>> Is it possible to create an object holding holding 1 bit, 2 bit, 3 bit
>> that still can be treated as a numerical value that can be added and
>> subtracted, without bit operations?
>
> No.
var o = {
valueOf: function () {
return (+!!this.bit3) * 4 + (+!!this.bit2) * 2 + (+!!this.bit1);
}
};
o.bit2 = 23;
/* 42 */
40 + o
/* 23 */
25 - o
--
PointedEars
FAQ: <http://PointedEars.de/faq> | SVN: <http://PointedEars.de/wsvn/>
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-matrix>
Please do not cc me. / Bitte keine Kopien per E-Mail.
Back to comp.lang.javascript | Previous | Next — Previous in thread | Find similar | Unroll thread
Make own type (object) type in javascript. jonas.thornvall@gmail.com - 2015-06-06 15:11 -0700
Re: Make own type (object) type in javascript. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-07 00:57 +0100
Re: Make own type (object) type in javascript. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-07 01:33 +0100
Re: Make own type (object) type in javascript. jonas.thornvall@gmail.com - 2015-06-06 17:37 -0700
Re: Make own type (object) type in javascript. jonas.thornvall@gmail.com - 2015-06-06 17:50 -0700
Re: Make own type (object) type in javascript. jonas.thornvall@gmail.com - 2015-06-06 18:03 -0700
Re: Make own type (object) type in javascript. jonas.thornvall@gmail.com - 2015-06-06 18:07 -0700
Re: Make own type (object) type in javascript. Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-06-07 10:19 +0100
Re: Make own type (object) type in javascript. jonas.thornvall@gmail.com - 2015-06-07 04:09 -0700
Re: Make own type (object) type in javascript. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2015-06-07 02:40 +0200
csiph-web