[1日]JavaScript 1
22748 ワード
1.学習内容
グーグル経済学
URL : http://analytics.google.com
より高いレベルの内部サイトを提供し、誰が、いつ、どのように私のサイトにアクセスするかを理解します.
個人ブログ、ショッピングサイト、会社のホームページに適用
JavaScript
1.F 12(開発者ツール)-コンソールの使用
Math.random() * 100;
文字列を
alert('안녕');
文字列を
「OK」をクリックしてF 12(開発者ツール)に戻ります.コンソールはtrueに戻り、「キャンセル」をクリックしてfalseに戻ります.
confirm('진짜?');
文字を入力して「OK」を押して入力した文字を返し、入力せずに入力をキャンセルするとnullを返します.
prompt('아이디?');
alert(Math.random()*100));
alertを連続的に作成すると、作成したalertウィンドウに従って開きます.
alert(1); alert(2);
通知ウィンドウで、呼び出し通知ウィンドウと同じ数値を入力してみます.
for (let i=1; i<=10; i++)
alert(i);
2.Vscodeでの実習
<html>
<body>
<script>
alert('1');
alert('2');
alert('3');
</script>
</body>
</html>
<html>
<body>
<script>
document.write('1+1 = ');
document.write(1+1);
document.write('<br>');
const num = Math.random()*100;
document.write(Math.floor(num));
document.write('<br>');
document.write(num.toFixed(1));
document.write('<br>');
</script>
<input type = "button" value = "hello" onclick = "alert('안녕');">
</body>
</html>
Number
<html>
<body>
<h1>Number</h1>
<script>
console.log(1);
console.log(1.2);
console.log('1 + 1 = ', 1+1);
console.log('5 - 3 = ', 5-3);
console.log('1 * 1 = ', 1*1);
console.log('4 / 4 = ', 4/4);
console.log('3 % 2 = ', 3%2);
console.log('Math.random : ', Math.random());
console.log('Math.Pi : ', Math.PI);
console.log('Math.floor(1.9) : ', Math.floor(1.9)); // 내림
console.log('Math.round(1.9) : ', Math.round(1.9)); // 반올림
console.log('toFixed : ', (Math.random()*100).toFixed(0));
//toFixed 소수점 자리 자르기
</script>
</body>
</html>
文字列
<h1>문자열(String)</h1>
<script>
console.log("hello world");
console.log(`hello
world`);
</script>
console.log('hello world'.length);
console.log('hell world'.replace('hell', 'hello'));
console.log('hello ' + 'world');
console.log('1'+'1');
variable
<!DOCTYPE html>
<html>
<body>
<h1>Variable</h1>
<script>
var a = 1;
a = 2;
console.log(a);
let b = 1;
b = 2;
console.log(b);
</script>
</body>
</html>
document.querySelect
ターゲットは
F 12(開発者ツール)-コンソール
document.querySelector('#container');
作成して
<input type = 'button' value = 'night mode' onclick = "document.querySelector('body').style.backgroundColor='black'">
<input type = 'button' value = 'day mode' onclick = "document.querySelector('body').style.backgroundColor='white'">
2.勉強の心得
簡単なJavaScript文法があり、いろいろな実践ができます.
これまで何の困難も解決できなかったことはありませんが、
復習して、学んだことを総合的に使う必要があると思います.
Reference
この問題について([1日]JavaScript 1), 我々は、より多くの情報をここで見つけました
https://velog.io/@lnglog/1일차-자바스크립트1
テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol
Reference
この問題について([1日]JavaScript 1), 我々は、より多くの情報をここで見つけました https://velog.io/@lnglog/1일차-자바스크립트1テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol