Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38768
| Path | csiph.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!nzpost2.xs4all.net!not-for-mail |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Number not greater or less than two limits |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <aZidnYDptsznPsTCnZ2dnUU7-XnNnZ2d@westnet.com.au> <slrnrlk38q.ja8i.jon+usenet@raven.unequivocal.eu> |
| Date | Thu, 10 Sep 2020 15:00:35 +0200 |
| Message-ID | <XnsAC3498AFECBE1eejj99@194.109.6.166> (permalink) |
| User-Agent | Xnews/2009.05.01 |
| Lines | 20 |
| NNTP-Posting-Host | a504cc87.newszilla.xs4all.nl |
| X-Trace | G=MyEc1q15,C=U2FsdGVkX18bfqfR4aYdC5absYFO8jSc1ZN+lIko6w6yf57PWlCJfvnJxvOPPtbvxyskqBo/DYFCD3PCY2kqpz06lrXOpL9EgR20jxwZau17/nLKmWkEDXHL5ULujwHo |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.javascript:38768 |
Show key headers only | View raw
Jon Ribbens wrote on 10 Sep 2020 in comp.lang.javascript: > value = min(maximum_value, max(minimum_value, value)) const clamp = (mini,valu, maxi) => Math.min(maxi, Math.max(mini, valu)); let res = clamp(1, 2, 3); console.log( res ); // 2 res = clamp(1, 4, 3); console.log( res ); // 3 res = clamp(1, 0, 3); console.log( res ); // 1 -- Evertjan. The Netherlands. (Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Number not greater or less than two limits Andrew Poulos <ap_prog@hotmail.com> - 2020-09-10 13:54 +1000
Re: Number not greater or less than two limits "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-09-09 23:09 -0700
Re: Number not greater or less than two limits Julio Di Egidio <julio@diegidio.name> - 2020-09-09 23:56 -0700
Re: Number not greater or less than two limits Andrew Poulos <ap_prog@hotmail.com> - 2020-09-10 17:44 +1000
Re: Number not greater or less than two limits Jon Ribbens <jon+usenet@unequivocal.eu> - 2020-09-10 11:25 +0000
Re: Number not greater or less than two limits "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-09-10 15:00 +0200
Re: Number not greater or less than two limits "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2020-09-10 15:59 +0200
Re: Number not greater or less than two limits Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2020-09-10 19:01 +0200
Re: Number not greater or less than two limits John G Harris <niam@jghnorth.org.uk.invalid> - 2020-09-11 16:04 +0100
csiph-web