Javascript13(응용JS_삼항연산자) feat.velopert
1. 삼항연산자
- 세개의 항으로 된 연산자
- 조건 ? true : false;
2. Truthy
- true 같은거
- !null, !undefined, !0, !'', !NaN, !false, ![], !{}
- 3, 'hello', ['array'], { name : 'a' }, true
3. Falsy
- flase 같은거
- null, undefined, 0, '', NaN, false, [], {}
- !3, !'hello', !['array'], !{ name : 'a' }, !true
4. null checking
functionprint(person){
	if(person===undefined||person===null)
		return;
	else
	console.log(person.name);
}
//값이있으면정상적으로작동
constperson={
	name:'John'
};
//값이없어서return
constperson=null;
print(person);
//위에함수랑동일하게동작
functionprint(person){
	if(!person)
		return;
	else
		console.log(person.name);
}   
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Author And Source
                            
                            이 문제에 관하여(Javascript13(응용JS_삼항연산자) feat.velopert), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://velog.io/@ansalstmd/Javascript13응용JS삼항연산자-feat.velopert
                            
                            
                            
                                저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
- true 같은거
- !null, !undefined, !0, !'', !NaN, !false, ![], !{}
- 3, 'hello', ['array'], { name : 'a' }, true
3. Falsy
- flase 같은거
- null, undefined, 0, '', NaN, false, [], {}
- !3, !'hello', !['array'], !{ name : 'a' }, !true
4. null checking
functionprint(person){
	if(person===undefined||person===null)
		return;
	else
	console.log(person.name);
}
//값이있으면정상적으로작동
constperson={
	name:'John'
};
//값이없어서return
constperson=null;
print(person);
//위에함수랑동일하게동작
functionprint(person){
	if(!person)
		return;
	else
		console.log(person.name);
}   
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Author And Source
                            
                            이 문제에 관하여(Javascript13(응용JS_삼항연산자) feat.velopert), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://velog.io/@ansalstmd/Javascript13응용JS삼항연산자-feat.velopert
                            
                            
                            
                                저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
                            
                            
                                
                                
                                 우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
functionprint(person){
	if(person===undefined||person===null)
		return;
	else
	console.log(person.name);
}
//값이있으면정상적으로작동
constperson={
	name:'John'
};
//값이없어서return
constperson=null;
print(person);
//위에함수랑동일하게동작
functionprint(person){
	if(!person)
		return;
	else
		console.log(person.name);
}   Author And Source
이 문제에 관하여(Javascript13(응용JS_삼항연산자) feat.velopert), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://velog.io/@ansalstmd/Javascript13응용JS삼항연산자-feat.velopert저자 귀속: 원작자 정보가 원작자 URL에 포함되어 있으며 저작권은 원작자 소유입니다.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)