<html>
<head>
<meta charset="UTF-8">
<title>삼각형 판별하기</title>
</head>
<!-- 삼각형을 만들기 위해서는 다음의 조건을 만족해야 합니다:
세 변의 길이는 양의 실수여야 합니다.
세 변의 길이 중 가장 긴 변의 길이는 나머지 두 변의 길이의 합보다 작아야 합니다. -->
<body>
<script>
//별도의 함수를 사용하지 않고 해결하기
function solution(a, b, c) {
let max;
let sum = a + b + c;
if (a > b) max = a;
else max = b;
if (c > max) max = c;
if ((sum - max) <= max) return 'NO'
return 'YES'
}
console.log('solution :', solution(13, 33, 17));
//Math.max 사용한 로직
function solution2(a, b, c) {
let sum = a + b + c;
let max = Math.max(a, b, c);
if ((sum - max) <= max) return 'NO'
return 'YES'
}
console.log('solution2 :', solution2(13, 33, 17));
</script>
</body>
</html>
<!-- 자연수 A, B, C 를 입력받아 세 수 중 가장 작은 값을 출력하는 프로그램을 작성하세요. -->
<!-- 정렬 사용 금지 -->
<body>
<script>
function findSmallest(a, b, c) {
let min = a;
if(a > b) min = b;
if(min > c) min = c;
return min;
}
console.log(findSmallest(3, 4, 5));
</script>
</body>
index.html에서 test.png 파일을 사용하고자 한다면? index.html과 images폴더는 같은 위치에 있기 때문에 './' or (생략가능) ' / ' 후 images폴더 속 파일이름 ./images/test.png , images/test.png
main.css에서 test.png 파일을 사용하고자 한다면? main.css의 입장에서 생각을 하면 된다. main.css는 css폴더의 하위에있습니다 ../를 사용해서 밖으로 나온다고 생각을 하면된다. images폴더로 들어가서 test.png를 찾는다고 생각하면됩니다. ../images/test.png
절대경로
각각의 파일의 위치에 상관없이 같은 경로를 이용하기 때문에 절대적인 경로다 라고 생각하면 편합니다.
index.html에서 test.png 를사용하고자 한다면? / 는 루트경로 즉 project 폴더를 의미합니다. 이 루트경로에는 images, css index.html 파일이 있습니다. /images/test.png
main.css 에서 test.png 를 사용하고자 한다면? 동일하다 절대경로이기 때문에 /images/test.png
index.html 에서 제 블로그에 있는 test.png를 이용하고자 한다면? https://j-plum.tistory.com/images/test.png