js2 字符串对象 数组 时间类
来源:互联网 发布:2017年网络语言 编辑:程序博客网 时间:2024/06/06 19:18
1 字符串对象
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <script> s1="Hello World"; s2= new String("Hello world"); console.log(typeof s1); console.log(typeof s2); document.write(s1.substr(1,4)); document.write('<br/>');// 顾前不顾后 document.write(s1.substring(2,4)); </script></head><body></body></html>
2. 数组
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <script> var arrname=[1,2,3]; var arrnamew= new Array([1,2,3]);// 数组的join方法 var arr=["11","22","hell"]; var sl=arr.join('--'); document.write(sl); console.log(sl); function Mysort(m,n) { return m-n; } var arr1=[100,56,23,4]; document.write(arr1.sort(Mysort)); </script></head><body></body></html>
3 时间类 可以进行时间的拼接 月份需要自己判断
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Title</title> <script> var t = new Data(); alert(t.toLocaleString()); </script></head><body></body></html>
阅读全文
0 0
- js2 字符串对象 数组 时间类
- 深入JS2.1获取时间
- js2
- js2
- js2
- js2
- JS2
- js2
- js2
- 对象数组转化字符串
- 对象 数组 字符串转
- 数组对象,字符串对象,Match对象
- json对象转化字符串、数组
- javascript 数组和对象字符串
- 基础知识(字符串,数组,对象)
- JS对象字符串数组排序
- 创建对象数组--jQuery数组和字符串
- js过滤字符串数组或对象数组
- 【SDN控制器分析之一】ONOS架构概述
- 琐记5:进制转换的程序实现
- BZOJ 2115: [Wc2011] Xor 线性基
- Eclipse常用快捷键
- 字符串与日期
- js2 字符串对象 数组 时间类
- shell版本的彩色进度条
- 解决Linux -bash: rz(或者是sz): command not found
- 通过GDB调试内核(Kernel)和模块(Module)
- Spring boot 项目Linux部署
- 对有限数组进行计数排序和求一个无序数组的中位数——题集(十八)
- CSS优先级计算
- redis持久化
- javascript数组排序Sort()