2018.8.17 several common global functions for JavaScript

Source: Internet
Author: User
Tags string to json

Common global functions for JavaScript
 <!doctype html>
parseInt(str); // 解析正整数parseFloat(str); // 解析小数setTimeout(function() {}, 3000); // 延迟3秒调用setInterval(function() {}, 3000); // 每隔3秒调用一次clearTimeout(id); // 清除延迟调用,id是setTimeout函数返回值clearInterval(id); // 清除定时器,id是setInterval函数返回值Math // 与数学相关的工具isNan(num) // 判断是否是一个非数字JSON.parse(str); // 解析一个json字符串JSON.stringify(json); // 序列化一个json对象eval(code); // 把一个字符串当做js代码来执行

function calls from JavaScript

function a(A){return A;}function b(B){//怎么样将A传到此处?A代表一个textbox;A.style.color=B;}

2018.8.17 several common global functions for JavaScript

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.