5js
Posted 知否知否,
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了5js相关的知识,希望对你有一定的参考价值。
对象
<script> var obj = { name: ‘zsf‘, sex: ‘nan‘, age: 33, sayHi:function() { console.log(‘Hi~~‘) } } console.log(obj.name) obj.sayHi() </script>
var obj2 = new object(); obj2.name = ‘拼多多‘ obj2.sayHi = function { console.log(‘Hi~~‘) }
function Star(uname,age,sex) { this.name = uname; this.age = age; this.sex = sex; this.sing = function(song) { console.log(song) } } var ldh = new Star(‘刘德华‘,23,‘男‘) console.log(typeof(ldh)) ldh.sing(‘是理想‘)
for (var k in ldh) { console.log(k); console.log(ldh[k]) }
以上是关于5js的主要内容,如果未能解决你的问题,请参考以下文章
[Canvas] Introduction to drawing with p5js