請(qǐng)問(wèn)大神我如果要設(shè)置絕對(duì)值和次方我要怎么樣去操作。
<script type="text/javascript">
? ?function demo(){
? ? ? ?var a=3.3;
? ? ? ?var b=-1;
? ? ? ?var c=(2,3);
? ? ? ?var d=8.9;
? var math=Math.random();
? ? ? ?/*document.write(Math.floor(a)+"<br/>");
? ? ? ?document.write(Math.floor(b)+"<br/>");
? ? ? ?document.write(Math.floor(c)+"<br/>");
? ? ? ?document.write(Math.floor(d));
? ? ? ?document.write(Math.ceil(a)+"<br/>");
? ? ? ?document.write(Math.ceil(b)+"<br/>");
? ? ? ?document.write(Math.ceil(c)+"<br/>");
? ? ? ?document.write(Math.ceil(d));
? document.write(Math.round(a)+"<br/>");
? ? ? ?document.write(Math.round(b)+"<br/>");
? ? ? ?document.write(Math.round(c)+"<br/>");
? ? ? ?document.write(Math.round(d));
? alert(math*10); */
? document.write(Math.abs(b));
? document.write(Math.pow(c));?
? ?}
? ? demo(); ??
? ??
</script>
2015-07-06
Math.pow(x,y);表示x的y次方
2015-07-23
Math.abs是絕對(duì)值。
你這一段代碼對(duì)我記憶所有的函數(shù)關(guān)系很有幫助,謝謝你~