This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------Returns odd numbers--------------------------------------------- | |
function printOdd(number){ | |
var i = 0; | |
var oddNum = []; | |
while (i <= number){ | |
if (i % 2 === 1){ | |
oddNum.push(i); | |
i++; | |
}else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Health(name,lastname){ | |
this.name = name; | |
this.lastname = lastname; | |
} | |
var a = Health("chanwoo","park"); //return값이 없기때문에 a는 언디파인드, 윈도우에 네임 변수를 생성했기때문에 'chanwoo'출력 | |
console.log(name); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Health(name,lastname){ | |
this.name = name; | |
this.lastname = lastname; | |
} | |
var a = Health("chanwoo","park"); //return값이 없기때문에 a는 언디파인드, 윈도우에 네임 변수를 생성했기때문에 'chanwoo'출력 | |
console.log(name); | |
var allFuntions = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test(a, b){ | |
a = { something : "this is something" }; | |
b.hello = "no greetings for you"; | |
} | |
var firstArg = { hello : "hello world" }; | |
var secondArg = { hello : "hello world" }; | |
test(firstArg, secondArg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function test(a, b){ | |
a.value = 70; | |
b = b * 20; | |
} | |
var firstArg = { age: 10 }; | |
var secondArg = 30; | |
test(firstArg, secondArg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//initial state | |
const data = { | |
id : null, | |
password : null | |
}; | |
export default function(state = data, action){ | |
switch(action.type){ | |
case ID_MODIFIED: | |
state.id = action.payload; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//initial state | |
const data = { | |
id : null, | |
password : null | |
}; | |
function reducer(state = data, action){ | |
switch(action.type){ | |
case ID_MODIFIED: | |
return {...state, id : action.payload }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component({ | |
template: ` | |
<h1>Hello! {{firstName}} {{lastName}}</h1> | |
<button (click)="changeName()">Change name</button> | |
` | |
}) | |
class MyApp { | |
firstName:string = 'Super'; | |
lastName:string = 'Cat'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Component() | |
class ContactsApp implements OnInit{ | |
firstName: string = 'Super'; | |
lastName: string = 'Cat'; | |
constructor(private http: Http) {} | |
ngOnInit() { | |
this.http.get('/name/mouse') |