博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
JavaScript中带有示例的Math.log2()方法
阅读量:2527 次
发布时间:2019-05-11

本文共 1374 字,大约阅读时间需要 4 分钟。

JavaScript | Math.log2()方法 (JavaScript | Math.log2() Method)

Math operations in JavaScript are handled using functions of math library in JavaScript. In this tutorial on Math.log2() method, we will learn about the log2() method and its working with examples.

JavaScript中的数学运算是使用JavaScript中的数学库函数处理的。 在有关Math.log2()方法的本教程中,我们将学习log2()方法及其示例。

JavaScript has multiple methods in its math library to support mathematical operations in JavaScript.

JavaScript在其数学库中有多种方法来支持JavaScript中的数学运算。

Math.log2() method in JavaScript is inbuilt. This function returns the value of the logarithmic value of base 2 of the number.

JavaScript中的Math.log2()方法是内置的。 此函数返回数字以2为底对数值的值

Syntax:

句法:

Math.log2(n);

Parameter(s):

参数:

  • n – It takes only one value which is the number whose logarithm is to be found.

    n –仅采用一个值,该值是要找到其对数的数字。

Return value:

返回值:

The return type of this method is number, it returns the log2 of the given number.

该方法的返回类型为number ,它返回给定数字的log 2

Example 1: finding the log of an integer.

示例1:查找整数的对数。

    Page Title    

Output

输出量

JavaScript | Math.log2() method | Example 1

Example 2: finding log of a string.

示例2:查找字符串的日志。

    Page Title    

Output

输出量

JavaScript | Math.log2() method | Example 2

When a string is passed to the log2() method. It returns NaN denoting the passed value is not a number.

将字符串传递给log 2 ()方法时 。 它返回NaN表示传递的值不是数字。

Example 3: Find the log of a complex number.

示例3:查找复数的日志。

    Page Title    

Output

输出量

Invalid or unexpected token

翻译自:

转载地址:http://zwvzd.baihongyu.com/

你可能感兴趣的文章
4.1 分解条件式
查看>>
Equivalent Strings
查看>>
flume handler
查看>>
收藏其他博客园主写的代码,学习加自用。先表示感谢!!!
查看>>
H5 表单标签
查看>>
su 与 su - 区别
查看>>
C语言编程-9_4 字符统计
查看>>
在webconfig中写好连接后,在程序中如何调用?
查看>>
限制用户不能删除SharePoint列表中的条目(项目)
查看>>
【Linux网络编程】使用GDB调试程序
查看>>
feign调用spring clound eureka 注册中心服务
查看>>
RotateCard(自定义旋转view)
查看>>
ZT:Linux上安装JDK,最准确
查看>>
LimeJS指南3
查看>>
关于C++ const成员的一些细节
查看>>
《代码大全》学习摘要(五)软件构建中的设计(下)
查看>>
C#检测驱动是否安装的问题
查看>>
web-4. 装饰页面的图像
查看>>
微信测试账户
查看>>
Android ListView上拉获取下一页
查看>>