Web109 [JavaScript] Number Object The Number object is a standard built-in object that is useful when handling the primitive type of numbers. Number Definition We can create an instance whose type is the Number using the Number() constructor. const numObj = new Number(); // [Number: 0] const numObj = new Number(10); // [Number: 10] const numObj = new Number('10'); // [Number: 10] const numObj = new Number('test'); // [Number: Na.. 2022. 7. 7. [JavaScript] Array Arrays in JS are sparse array that is not continuously connected in memory. Compared to a typical array, accessing the index is fast, and inserting/deleting is slow. Neither JS arrays' length nor its elements' types are fixed. Create Arrays There are 4 ways to create arrays. Array Literal const arr1 = [1, 2, 3]; const arr2 = ["apple", 2, "carrot", 4]; Array Constructor const arr = new Array(3); .. 2022. 7. 6. [JavaScript] Class From ES6, JS has class. JS is a prototype-based language. Therefore, classes in JS are slightly different from those in other object-oriented languages. A class is basically a data type that collected variables and methods for similar purposes. Class Declaration A statement or expression can declare classes. Both anonymous and named declarations are possible in expression. class Person {} const .. 2022. 7. 1. [JavaScript] Object Objects of JS are a collection of related data and/or functionality. Objects can have multiple primitive types of values. The primitive type of value is immutable, but the object type of value is mutable. Property An object is a set of zero or more properties, and the property consists of a key and a value. If the value of the property is a function, it is called a method. Key Key can be string .. 2022. 6. 26. [JavaScript] Function Function in JS is objects. Especially, first-class objects. The function is an important thing to understand JS. Function Definition There are 4 ways to define function. Function Definition Statement This is a statement, so it can be located in any place where there can be a statement. function adder(x, y) { return x + y; } Since ambiguity occurs by function hoisting, it is not recommended. cons.. 2022. 6. 25. [JavaScript] Control Flow Statements Conditional Statements if ... else statement JS's if/else statement is similar to other programming languages. if (conditions_1) { statements_1 } else if (conditions_2) { statements_2 } else { statements_last } If the conditions_1 is true, the statements_1 is executed, and if the conditions_1 is false and conditions_2 is true, the statements_2 is executed. Lastly, all conditions are false, the s.. 2022. 6. 22. [JavaScript] Operators The operators of JS are not much different from other languages. Assignment Operators Assignment: = Addition assignment: += Subtraction assignment: -= Exponentiation assignment: **= Multiplication assignment: *= Division assignment: /= Remainder assignment: %= Left shift assignment: = Unsigned right shift assignment: >>>= Bitwise AND assignment: &= Bitwise XOR assignment: ^= Bitwise OR assignmen.. 2022. 6. 21. [JavaScript] Data Types JS is a dynamic typing language, i.e. the data type of a variable is inferred by its value. In other words, variables don't have a type, but values have a type. JS has several primitive data types and an object type. However, I will explain it from the point of the developer. If a data types are not a primitive type, it is an object type. All primitive types are immutable. Let's find out about t.. 2022. 6. 19. [JavaScript] Variable There are two types of variables in JS. One is a mutable type and the other is an immutable type. And, we use var, let, and const keywords for defining a variable. Mutable Variable We use the var and let keyword for defining mutable variables. In the past, we used var, but now, we usually use let because var has issues like scope and hoisting. let mutable_var = 'I am a mutable variable.'; consol.. 2022. 6. 18. [CSS] Specificity Specificity is the means by which browsers decide which CSS property values are the most relevant to an element and, therefore, will be applied. Specificity is based on the matching rules which are composed of different sorts of CSS selectors. Calculating Universal Selectors, Combinators, and Negation Selector : No points Universal selector (*), combinators (+, >, ~, ' ', ||) and negation psuedo.. 2021. 12. 7. [JavaScript] console object The console object provides access to the browser's debugging console. The console object can be accessed from any global object. Methods console.assert() This method writes an error message to the console if the assertion is false. If the assertion is true, nothing happens. for (let i = 0; i < 4; i++) { console.assert(i % 2 == 0, `The number ${i} is not an even number.`); } console.clear() This.. 2021. 12. 6. [Svelte] Svelte Element Svelte has some useful elements. Let's take a look at it. This element allows a component to include itself, recursively. This element is useful in cases such as tree traverse. I created an object with a repeated structure and passed using props. {objs.name} {#if objs.children} {#each objs.children as objs} {/each} {/if} is the same as . This element renders a component dynamically, using the co.. 2021. 12. 5. 이전 1 2 3 4 5 ··· 10 다음