Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #31160

Re: A little exercise

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.javascript
Subject Re: A little exercise
Date 2016-08-25 06:35 +0200
Organization PointedEars Software (PES)
Message-ID <11622426.uLZWGnKmhe@PointedEars.de> (permalink)
References <exercise-20160824221308@ram.dialup.fu-berlin.de> <npl8pt$8e9$1@news.albasani.net> <Date-20160825000825@ram.dialup.fu-berlin.de> <random-20160825001943@ram.dialup.fu-berlin.de>

Show all headers | View raw


Stefan Ram wrote:

>   But then, »unix = Math.round(+new Date()/1000)«,

The unary plus operator –

<http://ecma-international.org/ecma-262/7.0/#sec-unary-plus-operator>

– is unnecessary as the “/” operator is a Multiplicative Operator (like “*” 
and “%”) that already converts its operands to Number:

<http://ecma-international.org/ecma-262/7.0/#sec-multiplicative-operators-runtime-semantics-evaluation>

And since a UNIX timestamp has only seconds, it is debatable whether it 
should not be Math.floor(…) instead of Math.round(…).

-- 
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 | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: A little exercise Andreas Bergmaier <andber93@web.de> - 2016-08-25 00:58 +0200
  Re: A little exercise Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-25 06:35 +0200

csiph-web