前端开发小技巧记录 - 持续更新

记录一些常用的js工具方法,前端开发一些小技巧

1. 判断数据类型

const typeofData = o => o==null?  
      String(o):
      Object.prototype.toString.call(o).slice(8, -1).toLowerCase()

在这里插入图片描述

2. 定义多个变量方式

var express = require('express') 
    , http = require('http') 
    , app = express() 
    , domain = require('domain') 
    , trycatch = require('trycatch'); 

3. 多行字符串

const content = `
	1. 多金
	2. 180
	3. 赛潘安
`
const otherContent = '\
	1. 多金\
	2. 180\
	3. 赛潘安\
'

猜你喜欢

转载自blog.csdn.net/qq_26728227/article/details/121401127
今日推荐