1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /**
- * Created by chen on 2017/9/13.
- */
- console.log(["1", "2", "3"].map(parseInt))
- var val = 'smtg';
- console.log('Value is ' + (val === 'smtg') ? 'Something' : 'Nothing');
- function foo() { }
- var oldName = foo.name;
- foo.name = "bar";
- console.log([oldName, foo.name])
- var name = "The Window";
- var object = {
- name : "My Object",
- getNameFunc : function(){
- return function(){
- return this.name;
- };
- }
- };
- console.log(object.getNameFunc()());
- var name = "The Window";
- var object = {
- name : "My Object",
- getNameFunc : function(){
- var that = this;
- return function(){
- return that.name;
- };
- }
- };
- console.log(object.getNameFunc()());
- var User = {
- count: 1,
- getCount: function() {
- return this.count;
- }
- };
- console.log(User.getCount());
- var func = User.getCount;
- console.log(func());
|