Back to feed
Renewal·서른의 생활코딩

Sample Source 3) JavaScript Basic Document Structure (Objects and Arrays)

NS
normalstory
cover image






Java is an object-oriented language.
And JavaScript is an object-based language.







So what exactly is an object?
Here is my own interpretation.

Objects... and the concept of being "based" on them.
In a way, even a person is an object.
A moving car, a bicycle... flowing water.

However, a stationary bicycle, a parked car — they are oriented toward being moved.
They need a person.

Programs made with Java react to input.
JavaScript runs first. Then it responds to user interactions.

When programming ( regardless of size and scope)
if you make it execute on its own from the start, that is JavaScript,
while if it launches a program window and then waits for the user’s command, I think that is closer to an object-oriented language like Java.

Again, I mean this regardless of functionality or scale.
(There are so many excellent Java developers who dismiss scripting that I keep repeating this.)

To use a metaphor for them,
Java, the object-oriented language, is like a grand and imposing general.
They do amazing work, but they do not move a single step without the king’s command.
JavaScript, the object-based language, is like the Pied Piper.
Sometimes they are noisy and sometimes they spread things on their own in a rather unruly way, but they also drive change from the roots upward, gather the public voice of users, and respond to those demands more appropriately than kings such as programmers, producers, planners, or sellers.




Books and lectures define it like this:

Object = the target window or document


1. Objects by hierarchy: window, document, ...


2. Objects unrelated to hierarchy: array, date, function, ...


Property = an object attribute or characteristic


Method = function or role






Object notation =>


object.property=value document.gbcolor='red'


object.method window.close()


parentObject.childObject.property='value'


document.form1.ID(name).value='Hong Gil-dong'







And arrays.




Array


Handling two or more values of the same type together = multiple values can be stored in one variable




Notation)


Declaring it as an array tells the variable that it is an array.


1. 1) var variable=new Array()


2) var variable=new Array(4) :: I will store up to 4 items.




variable[0]=value1;


variable[1]=value2;


variable[2]=value3;


variable[3]=value4;




2. var variable = new Array(value1, value2, value3, value4);


3. var variable = [ "value1","value2","value3","value4" ]






yoil (below) becomes the object,


and length (which returns the number of elements) becomes the property.











I talked too much... haha
Let us store the seven days of the week in one variable.
First, there are two-




<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">




<head>


<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />




<title> </title>




<script type="text/javascript">


//<!CDATA[




var yoil=new Array();


yoil[0] = "Monday" ;


yoil[1] = "Tuesday" ;


yoil[2] = "Wednesday" ;


yoil[3] = "Thursday" ;


yoil[4] = "Friday" ;


yoil[5] = "Saturday" ;


yoil[6] = "Sunday" ;




blood=["a","b","ab","o"];




for(i=0; i < yoil.length; i++){


document.write(yoil[i] + "<br />");


}


for(i=0; i < blood.length; i++){


document.write(blood[i] + "<br />");


}




//]]]]]]>


</script>




</head>






<body>






</body>




</html>



This English version was translated by Claude.

친절한 찰쓰씨
Written by
친절한 찰쓰씨

Pleasant Charles — UI/UX researcher at AIT. Keeping notes on design, planning, and slow days here since 2010.

More on the author's page

Keep reading

Renewal

Steadily, for the long haul, without burning out

Mar 31, 2026·9 min
Renewal

Tech-life balance

Feb 7, 2026·3 min
Renewal

Humanality, by Park Jeong-ryeol

Feb 7, 2026·11 min