Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

Lister les propriétés et méthodes de l'objet math

3 réponses
Avatar
ast
bonjour,

Comment lister les propriétés et méthodes de l'objet math ?

Le script suivant ne marche pas:


<SCRIPT type="text/javascript">

for (var i in Math) {
document.write(i + "<BR>");
}
</SCRIPT>

Bizarrement, si je remplace math par document ou par window
ça marche.

Pourtant math est bien un objet.

3 réponses

Avatar
yamo'
Salut,

ast a tapoté, le 23/02/2011 09:36:
for (var i in Math) {



Avec google on trouve tout de suite :
<http://stackoverflow.com/questions/3398098/why-does-forvar-i-in-math-not-iterate-through-math-in-javascript>

--
Stéphane

<http://pasdenom.info/fortune/>
Avatar
ast
"yamo'" a écrit dans le message de news:ik2hcb$ji7$
Salut,

ast a tapoté, le 23/02/2011 09:36:
for (var i in Math) {



Avec google on trouve tout de suite :
<http://stackoverflow.com/questions/3398098/why-does-forvar-i-in-math-not-iterate-through-math-in-javascript>




merci
Avatar
Dr J R Stockton
In fr.comp.lang.javascript message <4d64c6f4$0$18604$
fr>, Wed, 23 Feb 2011 09:36:00, ast posted:

bonjour,

Comment lister les propriétés et méthodes de l'objet math ?

Le script suivant ne marche pas:


<SCRIPT type="text/javascript">

for (var i in Math) {
document.write(i + "<BR>");
}
</SCRIPT>

Bizarrement, si je remplace math par document ou par window
ça marche.

Pourtant math est bien un objet.



Essayez en autres browsers, e.g. Chrome, Safari.

Essayez <http://www.merlyn.demon.co.uk/js-props.htm#F> -
Enter, et puis mettez 'Math' en lieu de 'document' et Enter, et puis
choisissez-vous le bouton "If possible, use Object.getOwnPropertyNames(e
lement)" et Enter.

--
(c) John Stockton, nr London UK. ?@merlyn.demon.co.uk IE8 FF3 Op10 Sf5 Cr7
news:comp.lang.javascript FAQ <http://www.jibbering.com/faq/index.html>.
<http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.