摘要:
/** * Created by ufo9631 on 2017/5/16. */ export class hello{ } /*字符串新特性*/ /*----多行字符串------*/ var mulitStr=`多行字 符串`; /*----字符串模板---------*/ var name ='zhai liang'; var getName=function() { ... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/25. */ //注解 告诉一个框架怎么来处理一个TypeScript程序 //类型定义文件(*.d.ts) //类型定义文件用来帮助开发者在TypeScript中使用已有的JavaScript的工具包 //如:Jquery export var prop1;//暴露这个属性 var prop2; //不对外暴露 ... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/25. */ //一个文件就是一个模块 //export import export var prop1;//暴露这个属性 var prop2; //不对外暴露 export function func(){ } function func2()//不对外暴露 { $("xxx").add();//有了这个jq... 阅读全文
摘要:
import {prop1, C1,func} from "./ts9"; /** * Created by ufo9631 on 2017/5/25. */ console.log(prop1); func(); new C1(); export function func3() { } 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/25. */ var name:string; function test1() { let name:string; name="Hello world"; console.log(name); } test1(); 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/25. */ //一个文件就是一个模块 //export import export var prop1;//暴露这个属性 var prop2; //不对外暴露 export function func(){ } function func2()//不对外暴露 { } export class C1{ ... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/25. */ //一 interface IPerson{ name:string; age:number; } class Person { constructor(public config:IPerson) { } } var p1=new Person({ na... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/25. */ //泛型:参数化的类型,一般用来限制集合的内容 /** * Created by ufo9631 on 2017/5/25. */ class Person{ public name; //不指定访问控制符默认是public //类被实例化的时候会被调用 constructor... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/25. */ class Person{ public name; //不指定访问控制符默认是public //类被实例化的时候会被调用 constructor(name:string){ //console.log("哈哈"); this.name=name; ... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/17. */ var myArr = [1, 2, 3, 4, 5]; myArr.desc = "five number"; myArr.forEach(function (value) { return console.log(value); }); //forEach不能使用break for (var n in m... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/17. */ var myArr=[1,2,3,4,5]; myArr.desc="five number"; myArr.forEach(value=>console.log(value)); //forEach不能使用break for(var n in myArr) { console.log(n); } ... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/17. */ //箭头表达式 消除javascrpt 带来的this问题 var sum = function (arg1, arg2) { return arg1 + arg2; }; //箭头表达式,声明匿名函数 var sum1 = function (arg1, arg2) { return arg1 + ... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/16. */ /*函数新特性*/ function func1() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i - 0] = arguments[_i]; } args.fo... 阅读全文
摘要:
/** * Created by ufo9631 on 2017/5/16. */ /*参数新特性*/ var maname = "zhang san"; //声明字符串类型变量 var alias = "xixi"; //任意类型 var age = 12; //整形 var man = false; //布尔类型 function test() { } function testStr(... 阅读全文