if문안의 변수를 if문 밖에서 사용 하고 싶었을 때, var말고 삼항연산자로 해결
if문안의 var 변수를 밖에서 if문 밖에서 사용 하고 싶었을 때, 변수를 var로 선언해서 사용하면 되긴 하지만 좋은 방법은 아니기 때문에 어떻게 할까 고민하다가 , 삼항연산자로 해결했습니다. 까먹을까봐 블로그에 적어둡니다. 참고 : https://www.w3schools.com/js/js_scope.asp JavaScript Scope W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more. www.w3sc..