전체 글343 [JavaScript] RegExp Object The RegExp object is used for matching text with a pattern. It introduced PCRE from ES3. Create a Regular Expression RegExp instance can be created by the constructor or literal notation. Please see the 3 ways below. const re = /ab+c/i; const re = new RegExp('ab+c', 'i'); const re = new RegExp(/ab+c/, 'i')); The pattern syntax is below. /PATTERN/FLAG / symbol means to start and end. In other wor.. 2022. 7. 9. [JavaScript] Date Object The Date object represents a single moment in time in a platform-independent format. It contains a Number that represents milliseconds since 1970/01/01 00:00:00 UTC. There is a difference in the result representation depending on the browser environment and node.js environment. Date Constructor There are 4 ways to create a Date instance. new Date() It returns a date instance with the current dat.. 2022. 7. 9. [JavaScript] Math Object Math is a standard built-in object that has only static properties and static methods for mathematical constants and functions. It works with the Number type and doesn't work with the BigInt type. Math Property E This property is Euler's constant. Math.E; // 2.718281828459045 LN2 This property is a natural logarithm of 2. Math.LN2; // 0.6931471805599453 LN10 This property is a natural logarithm .. 2022. 7. 8. [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. 이전 1 ··· 7 8 9 10 11 12 13 ··· 39 다음