内置函数
:嵌入到主调函数中的函数称为内置函数,又称内嵌函数。 作用是提高程序的执行效率
<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>