3-9 Introspection 函数 -type-of()
本节编程练习不计算学习进度,请电脑登录imooc.com操作

Introspection 函数 -type-of()

type-of() 函数主要用来判断一个值是属于什么类型:

返回值:

>> type-of(100)
"number"
>> type-of(100px)
"number"
>> type-of("asdf")
"string"
>> type-of(asdf)
"string"
>> type-of(true)
"bool"
>> type-of(false)
"bool"
>> type-of(#fff)
"color"
>> type-of(blue)
"color"
>> type-of(1 / 2 = 1)
"string"

任务

你可以写出下面函数运行出的结果吗?

  1.  
  2. type-of(false)
  3.  
  4. type-of(green)
  5.  
  6. type-of(10 / 5 = 2)
下一节