9月19日

 内置函数

嵌入到主调函数中的函数称为内置函数,又称内嵌函数。 作用是提高程序的执行效率

<body>
		<script type="text/javascript">
			var student=new Object()
			console.log(student)
			
			student.stuid="1001"
			student.stuname="张三"
			student.className="移动2班"
			
			student.sayHello=function(){
				console.log("大家好")
			}
			student.sayHello()
			console.log(student.stuid)
			
			function teacher(tid,tname){
				this.tid=tid
				this.tname=tname
				this.eat=function(){
					console.log("吃饭")
				}
				
			}
			var ti=new teacher("1","杨哥")
			
			tl.eat()
			console.log(tl.tid,tl.tname)
		</script>
	</body>

 内置对象

 

 

 

<body>
		<script type="text/javascript">
			var str="Hello world!"
			console.log(str.length)
			console.log(str.charAt(2))
			
			console.log(str.indexOf("l"))
			console.log(str.indexOf("b"))
			
			console.log(str.substring(0,5))
			
			console.log(syr.substr(1,2))
		</script>
	</body>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值