매일 탐구한 MDN 문서를 내맘대로 요약한다!
초심자의 경우
여러 영상을 통해 선학습 한 뒤, MDN document 를 읽으면,
학습한 내용을 정리하는데 도움이 된다.
이 방법은 한 챕터를 여러번 보기 때문에 갱장히 오랜 시간이 걸린다는 점 참고 🎶 ~~
꼼꼼한 사람 추천! ~~꼼꼼이라 쓰고 집요라고 읽는다.
✔️START __
Adding variables to store our data
: Variable is a container for a value.
<button id="button_A">Press me</button>
<h3 id="heading_A"></h3>
const buttonA = document.querySelector('#button_A');
const headingA = document.querySelector('#heading_A');
buttonA.onclick = function() {
let name = prompt('What is your name?');
alert('Hello ' + name + ', nice to see you!');
headingA.textContent = 'Welcome ' + name;
}
-*Declaring a variable! __ all code instructions should end with a semi-colon(;
)*
let / var
followed by a name for your valuable
let
was created in modern versions.
var
can declare the same variable as many times as you like, but with let
you can't ! *It just makes things more confusing.
▶️ Recommend that use let
as much as possible in your code.
age
myAge
init
initialColor
finalOutputValue
audio1
audio2
keywords__ A fairly complete list of reserved keyword to avoid at Lexical grammar
'hi'
or "hi"
let dolphinGoodbye = "So long and thanks for all the fish" ;
let test = 6 < 3;
//It returns false
let myNameArray = ['Chris', 'Bob', 'Jim'];
let myNumberArray= [10, 15, 20];
myNameArray[0]; //should return 'Chris' __ index start 0. 0 ,1, 2
myNumberArray[2]; //should return 20
let dog = { name:'happy' , breed:'Dalmatian'};
dog.name //to retrieve the information strored in the object
const
: Used to store values that are immutable or can't be changed !
const daysInWeek = 7;
const hoursInDay= 24;