728x90
반응형

JavaScript Math Methods

MethodDescription

abs(x) Returns the absolute value of x
acos(x) Returns the arccosine of x, in radians
acosh(x) Returns the hyperbolic arccosine of x
asin(x) Returns the arcsine of x, in radians
asinh(x) Returns the hyperbolic arcsine of x
atan(x) Returns the arctangent of x as a numeric value between -PI/2 and PI/2 radians
atan2(y, x) Returns the arctangent of the quotient of its arguments
atanh(x) Returns the hyperbolic arctangent of x
cbrt(x) Returns the cubic root of x
ceil(x) Returns x, rounded upwards to the nearest integer
cos(x) Returns the cosine of x (x is in radians)
cosh(x) Returns the hyperbolic cosine of x
exp(x) Returns the value of Ex
floor(x) Returns x, rounded downwards to the nearest integer
log(x) Returns the natural logarithm (base E) of x
max(x, y, z, ..., n) Returns the number with the highest value
min(x, y, z, ..., n) Returns the number with the lowest value
pow(x, y) Returns the value of x to the power of y
random() Returns a random number between 0 and 1
round(x) Rounds x to the nearest integer
sign(x) Returns if x is negative, null or positive (-1, 0, 1)
sin(x) Returns the sine of x (x is in radians)
sinh(x) Returns the hyperbolic sine of x
sqrt(x) Returns the square root of x
tan(x) Returns the tangent of an angle
tanh(x) Returns the hyperbolic tangent of a number
trunc(x) Returns the integer part of a number (x)

 

Math.random()

Math.random(); : returns a random number between 0 (inclusive),  and 1 (exclusive)

ex )  Returns a random integer from 0 to 9: Math.floor(Math.random() * 10)

ex ) Returns a random integer from 0 to 10: Math.floor(Math.random() * 11);

ex ) Returns a random integer from 1 to 10: Math.floor(Math.random() * 10) + 1;

 

Operator Description Comparing Returns
== equal to x == 8 false


x == 5 true


x == "5" true
=== equal value and equal type x === 5 true


x === "5" false
!= not equal x != 8 true
!== not equal value or not equal type x !== 5 false


x !== "5" true


x !== 8 true
> greater than x > 8 false
< less than x < 8 true
>= greater than or equal to x >= 8 false
<= less than or equal to x <= 8 true

 

728x90
반응형

'JAVASCRIPT' 카테고리의 다른 글

20241125_1 Loop  (12) 2024.11.25
20241122_3 Comparison  (4) 2024.11.22
20241122_1 Date Objects  (0) 2024.11.22
20241121_2 Arrays  (0) 2024.11.21
20241121_1 Numbers  (2) 2024.11.21
728x90
반응형

new Date()
new Date(date string)

new Date(year,month)
new Date(year,month,day)
new Date(year,month,day,hours)
new Date(year,month,day,hours,minutes)
new Date(year,month,day,hours,minutes,seconds)
new Date(year,month,day,hours,minutes,seconds,ms)

new Date(milliseconds)

Date Input

ISO Date "2015-03-25" (The International Standard)
Short Date "03/25/2015"
Long Date "Mar 25 2015" or "25 Mar 2015"

 

Date Input - Parsing Dates

 Date.parse()   : If you have a valid date string, you can use the method to convert it to milliseconds.

Date Get Methods

getFullYear() Get year as a four digit number (yyyy)
getMonth() Get month as a number (0-11)
getDate() Get day as a number (1-31)
getDay() Get weekday as a number (0-6)
getHours() Get hour (0-23)
getMinutes() Get minute (0-59)
getSeconds() Get second (0-59)
getMilliseconds() Get millisecond (0-999)
getTime() Get time (milliseconds since January 1, 1970)

Set Date Methods

MethodDescription

setDate() Set the day as a number (1-31)
setFullYear() Set the year (optionally month and day)
setHours() Set the hour (0-23)
setMilliseconds() Set the milliseconds (0-999)
setMinutes() Set the minutes (0-59)
setMonth() Set the month (0-11)
setSeconds() Set the seconds (0-59)
setTime() Set the time (milliseconds since January 1, 1970)

 

 

728x90
반응형

'JAVASCRIPT' 카테고리의 다른 글

20241122_3 Comparison  (4) 2024.11.22
20241122_2 Math Object  (0) 2024.11.22
20241121_2 Arrays  (0) 2024.11.21
20241121_1 Numbers  (2) 2024.11.21
20241120_ String (Methods,Templates)  (0) 2024.11.20
728x90
반응형


우연히 본 냉동 대창 광고를 보고

이건 먹어야겠다 싶어서 주문함



1kg을 2만원대에 주문했더니

제생각엔 남자 1명기준 4인분정도되는거같아요

그래서 순대국밥을 포장해와서

넣고 다시 끓여보니 그유명한 성시경 화목식당의

내장국밥의 맛이 ㅎㅎㅎ



그리고 대창덮밥;)

집에 넣을게 마늘이랑 소스밖에 없어서

이것저것 다 넣어서 볶으니깐

핵!꿀!맛!



간장 대충 쬐금
고추가루 대충 조금
마늘 조금
굴소스도 있으니 넣고
액젓도 있넹?! 고럼 이것도 ㄱㄱ
설탕이 없어서 요리당으로 한바퀴 둘러주고

사실 남들한테 이렇게 보여주는 게 맞나?

ㅋㅋㅋ

한 이삼분 두면 될거같다싶어!

이제부터 햇반을 전자레인지로 딱!!

지글지글!

소스가 쫄면 막 튀기니깐

뚜껑닫고 이분만 더


됐다 싶으면 밥위에 올려서

파슬리 깨 뿌려주고 데코!똭!

혼자 궁상맞지만 요리 10분

먹는거 3분

 

내돈내산! 자취생 꿀조리법.ㅎ

함 찍고 기록해둬야지하며 열심히 찍어봤어요;)

곱창같은 대창인데 진짜 맛있음요!!

근데 저는 잡내를 좋아하는 편인데.

아마 국밥에 잡내를 싫어하시면 못드실 거 같아요.


혹시 찾기 좋으시라고 밑에 링크도 둿어요.

진짜 좀 해놓고 소분해두면 삼분요리 저리가라.

간단!!조리 굳굳굳
 

 

돈두육미 국내산 삶은돼지 대창, 1kg, 1개 - 곱창/막창/대창 | 쿠팡

현재 별점 4.3점, 리뷰 387개를 가진 돈두육미 국내산 삶은돼지 대창, 1kg, 1개! 지금 쿠팡에서 더 저렴하고 다양한 곱창/막창/대창 제품들을 확인해보세요.

www.coupang.com

이 포스팅은 쿠팡 파트너스 활동의 일환으로,
이에 따른 일정액의 수수료를 제공받습니다.

728x90
반응형
728x90
반응형

unlike  : 같지않은, 다른 , 닮지 않은

precision : 정확

accurate  : 정확한

infinity : 무한대

Recognize  : 인지하다.

behave : 행동하다.

overwrite  : 덮어쓰다.

By default : 기본적으로

728x90
반응형

'ENG' 카테고리의 다른 글

1  (0) 2024.11.20
728x90
반응형

 

갑자기 추워진 요즘. 회사  건물에서
히터를 너무 빵빵하게 틀어줘서 가습기가 너무 필요했다. 
근데 사실 작고 귀엽고 저렴한 가습기를 구매하고 싶어서
쿠팡에서 저렴한 가습기를 기준으로 보니 귀여운 가습기가 만원에 안되게 있었다. 
그래서 구매한 가습기!!!!!!!!!!!!!
 

 

 
쿠팡이름에 걸맞게 빠른 배송은 아니고 직구였지만. 
귀여운 캐릭터를 포기할 수 없어 구매했다. 
 
 
하지만 뭐 성능은 그냥 저렴한 캐릭터 가습기....
아쉽지만 그냥 장식용으로 두기 좋을 거 같아서 만족한다.


 
쓸때없이 조명도 있음. 프로펠라(자동아님.)도 있고 
무선도 됨.
책상위에 두고 쓸거라서 습기에
종이나 전자제품이 젖을까봐 걱정했는데
그런 걱정은 안해도 될만큼 안정적으로 나와요.
 
 
디자인을 생각해본다면 두개 쌍으로 두고 써도 좋을 거 같아요. 
 
내돈내산 후기.!
가습기 성능 : 3/10
귀여움 : 8/10
 
밑에 링크는 걸어두었어용~ㅎ
 

 

세계일주 USB 미니 가습기 무소음 차량용 독서실 휴대용 소형 무드등 300ml - 가습기/에어워셔 | 쿠

쿠팡에서 4.9 구매하고 더 많은 혜택을 받으세요! 지금 할인중인 다른 49 제품도 바로 쿠팡에서 확인할 수 있습니다.

www.coupang.com

 
 
 

이 포스팅은 쿠팡 파트너스 활동의 일환으로,
이에 따른 일정액의 수수료를 제공받습니다.

728x90
반응형
728x90
반응형

Converting an Array to a String

.toString() : converts an array to a string of (comma separated) array values.

Looping Array Elements

.forEach(Function);

Adding Array Elements

.push(value) : add a new element to an array  or array[array.length] = "" 

new Array()

ex)new Array( value , value);    new Array(position);

How to Recognize an Array

Array.isArray(fruits); or (fruits instanceof Array);

Array Methods

.length :  returns the length (size) of an array

.toString() : converts an array to a string of (comma separated) array values

.at(position);  eturns an indexed element from an array. == array[position]

.join(" * ") :  like toString()  but in addition you can specify the separator

.pop()  : removes the last element from an array

.push(value) : adds a new element to an array (at the end)

.shift() : returns the value that was "shifted out"

.unshift(value) :   adds a new element to an array (at the beginning), and "unshifts" older elements. like array[0] = value

 

Array delete()

Using delete() leaves undefined holes in the array.

Use pop() or shift() instead.

Merging Arrays (Concatenating)

.concat(array) : creates a new array by merging (concatenating) existing arrays

Array copyWithin()

.copyWithin(position, copyValuePosition) : copies array elements to another position in an array

.copyWithin(position , copyValuePositionStartIndex , copyValuePositionEndIndex )  : does not change the length of the array.

Array flat()

const myArr = [[1,2],[3,4],[5,6]];   : creates a new array with sub-array elements concatenated to a specified depth.
const newArr = myArr.flat();

const myArr = [1, 2, 3, 4, 5, 6]; :  first maps all elements of an array and then creates a new array by flattening the array.
const newArr = myArr.flatMap(x => [x, x * 10]);

Splicing and Slicing Arrays

.splice(addPosition, removecount, addvalue, addvalue1......); : can be used to add new items to an array

.toSpliced(removePosition, removecount) :  safe way to splice an array without altering the original array.

 new toSpliced() method and the old splice() method is that the new method creates a new array, keeping the original array unchanged, while the old method altered the original array

.slice(removeIndex) :  slices out a piece of an array into a new array ( does not remove any elements from the source array. )

 

Array Search

 Array indexOf()

.indexOf("value")  : searches an array for an element value and returns its position.

.indexOf(value, start) : start at the given position counting from the end, and search to the end

 returns -1 if the item is not found.

.lastIndexOf(value)  : returns the position of the last occurrence of the specified element

.lastIndexOf(item, start) : start at the given position counting from the end, and search to the beginning

 

.includes(value) : to check if an element is present in an array( including NaN, unlike indexOf )

Array find()

.find(myFunction) : returns the value of the first array element that passes a test function

.findIndex(myFunction); :  returns the index of the first array element that passes a test function

.findLast(x => x > 40); : start from the end of an array and return the value of the first element that satisfies a condition

.findLastIndex(x => x > 40) : finds the index of the last element that satisfies a condition.

 

Sorting an Array

.sort(); : sorts an array alphabetically

.toSorted();  : as a safe way to sort an array without altering the original array

.reverse()  : reverses the elements in an array

.toReversed() : as a safe way to reverse an array without altering the original array.

 

Numeric Sort

sort() function sorts values as strings.

.sort(function(a, b){return a - b});

.sort(function(a, b){return b - a});

.sort(function(){return 0.5 - Math.random()});

Using Math.min() or Math.max() on an Array

Math.max.apply(null, arr)  : == Math.min(arr

Math.min.apply(null, arr) : == Math.max(arr

Array forEach()

.forEach( function) : calls a function (a callback function) once for each array element

Array map()

.map(function)

.flatMap(function) : 

Array filter()

.filter(function) : creates a new array with array elements that pass a test.

ex )  function parameter : value, index, array.

  • The item value
  • The item index
  • The array itself

Array reduce()

.reduce(myFunction) :  a function on each array element to produce (reduce it to) a single value.

.reduce(myFunction, number);

.reduceRight(myFunction) :   from right-to-left in the array.

  • The total (the initial value / previously returned value)
  • The item value
  • The item index
  • The array itself

Array every() , some()

.every(myFunction);  :  checks if all array values pass a test.

.some(myFunction); : checks if some array values pass a test.

  • The item value
  • The item index
  • The array itself

Array.from()

Array.from(String) :  returns an Array object from any object with a length property or any iterable object.

Array keys()

.keys(); : returns an Array Iterator object with the keys of an array.

Array entries()

.entries(); :  returns an Array Iterator object with key/value pairs

Array with() Method

with() method as a safe way to update elements in an array without altering the original array.

ex) = months.with(2, "March"); : replace the index 2 value  

Array Spread (...)

ex) const year = [...q1, ...q2, ...q3, ...q4];   :  ... operator expands an iterable (like an array) into more elements:

 

728x90
반응형

'JAVASCRIPT' 카테고리의 다른 글

20241122_2 Math Object  (0) 2024.11.22
20241122_1 Date Objects  (0) 2024.11.22
20241121_1 Numbers  (2) 2024.11.21
20241120_ String (Methods,Templates)  (0) 2024.11.20
20241120_2 기초2  (2) 2024.11.20
728x90
반응형

The maximum number of decimals is 17.

Adding Numbers and Strings

 JavaScript  interpreter works from left to right.  ex) number + number +string  case, both numbers added andthen add string

NaN - Not a Number

NaN + number = NaN, NaN + string ="NaNstring"

Infinity

calculate a number outside the largest possible number.

Hexadecimal

number.toString( Number system ) : 

 

BigInt

JavaScript can only safely represent integers:

Up to 9007199254740991 +(253-1)   Down to -9007199254740991 -(253-1).

How to Create a BigInt

BigInt(num); or let x = 12345.......n;

Arithmetic between a BigInt and a Number is not allowed

 

Minimum and Maximum Safe Integers

Number.MAX_SAFE_INTEGER : Integer max value

Number.MIN_SAFE_INTEGER  : Integer min value

Number.isInteger(number) : returns true if the argument is an integer.

Number.isSafeInteger(number) : r eturns true if the argument is a safe integer.

Number.MAX_VALUE : the largest possible number in JavaScript.

Number.MIN_VALUE  : the lowest possible number in JavaScript.

Number.POSITIVE_INFINITY

Number.NEGATIVE_INFINITY

Number Methods

toString() Returns a number as a string
toExponential() Returns a number written in exponential notation
toFixed() Returns a number written with a number of decimals
toPrecision() Returns a number written with a specified length
valueOf() Returns a number as a number

Converting Variables to Numbers

Number() Returns a number converted from its argument.
parseFloat() Parses its argument and returns a floating point number
parseInt() Parses its argument and returns a whole number

 

function isNaN() : find out if a value is a not a number

728x90
반응형

'JAVASCRIPT' 카테고리의 다른 글

20241122_1 Date Objects  (0) 2024.11.22
20241121_2 Arrays  (0) 2024.11.21
20241120_ String (Methods,Templates)  (0) 2024.11.20
20241120_2 기초2  (2) 2024.11.20
20241120_1 기본  (6) 2024.11.20
728x90
반응형

. length : length of a string

Extracting String Characters

.charAt(position) :  returns the character at a specified index (position)

.charCodeAt (position) :  returns a UTF-16 code 

.at (position) :  returns the character at a specified index (position) in a string.( supported in all modern browsers since March 2022 )

property Access : ex) String[position]

If no character is found, [ ] returns undefined, while charAt() returns an empty string.

 

Extracting String Parts

.slice( start,  end )  : returns the extracted part in a new string

.slice(position) : positive_ slice out the rest, negative_ slice out the end

. substring ( start,  end )  : similar to .slice(), but start and end values less than 0 are treated as 0

 

Converting to Upper and Lower Case

.toUpperCase() : converted to upper case

.toLowerCase() : converted to lower case 

 

 .concat("asdfa","asdfasdf") : joins two or more strings

.trim()  :  removes whitespace from both sides

.trimStart() : removes whitespace only from the start

.trimEnd() : removes whitespace only from the end

.padStart(lenght, String ) : string (multiple times) until it reaches a given length from the start (padStart is String method so can't use number) 

.padEnd(lenght, String ) :  string (multiple times) until it reaches a given length from the end (padEnd is String method so can't use number) 

.repeat(count) :  returns a string with a number of copies

Replacing String Content

.replace( value , new value) : replaces only the first match, case sensitive

                 To replace case insensitive, use a regular expression with an /i flag (insensitive)

                 To  replace all matches, use a regular expression with a /g flag

.replays(value, new value ) : 

 

Converting a String to an Array

string can be converted to an array with the .split() method   ex)x= 'j,e,o,n'; x.split(",") -> x = ['j','e','o','n']

 

String Search

.indexOf(value) : returns the index (position) of the first occurrence of a string in a string, or it returns -1 if the string is not found

.indexOf(value, startpoint) : if you want to select s tarting position for the search

.lastIndexOf(value) : eturns the index of the last occurrence of a specified text

.search(value) : returns the position of the match

               // .indexOf(value)  .search(value) . two methods are NOT equal. These are the differences 

               //  .search() can't select start-posittion 

.match( value ) : r eturns an array containing the results of matching a string against

.matchAll( value ) :  returns an iterator containing the results of matching a string against a string 

.includes( value ) :  returns true if a string contains a specified value( case sensitive )

.startsWith( value ) :  returns true if a string begins with a specified value

.startsWith( value, startposition ) :  start position for the search can be specified

.endsWith( value ) : returns true if a string ends with a specified value

.endsWith( value, endposition ) :  end position for the search can be specified

 

Interpolation

Template String provide an easy way to interpolate variables and expressions into strings

${...}

 

Variable Substitutions

ex )

let firstName = "John";
let lastName = "Doe";

let text = `Welcome ${firstName}, ${lastName}!`;

 

String Method~~~

at() Returns an indexed character from a string
charAt() Returns the character at a specified index (position)
charCodeAt() Returns the Unicode of the character at a specified index
codePointAt() Returns the Unicode value at an index (position) in a string
concat() Returns two or more joined strings
constructor Returns the string's constructor function
endsWith() Returns if a string ends with a specified value
fromCharCode() Returns Unicode values as characters
includes() Returns if a string contains a specified value
indexOf() Returns the index (position) of the first occurrence of a value in a string
lastIndexOf() Returns the index (position) of the last occurrence of a value in a string
length Returns the length of a string
localeCompare() Compares two strings in the current locale
match() Searches a string for a value, or a regular expression, and returns the matches
padEnd() Pads a string at the end
padStart() Pads a string from the start
prototype Allows you to add properties and methods to an object
repeat() Returns a new string with a number of copies of a string
replace() Searches a string for a pattern, and returns a string where the first match is replaced
replaceAll() Searches a string for a pattern and returns a new string where all matches are replaced
search() Searches a string for a value, or regular expression, and returns the index (position) of the match
slice() Extracts a part of a string and returns a new string
split() Splits a string into an array of substrings
startsWith() Checks whether a string begins with specified characters
substr() Extracts a number of characters from a string, from a start index (position)
substring() Extracts characters from a string, between two specified indices (positions)
toLocaleLowerCase() Returns a string converted to lowercase letters, using the host's locale
toLocaleUpperCase() Returns a string converted to uppercase letters, using the host's locale
toLowerCase() Returns a string converted to lowercase letters
toString() Returns a string or a string object as a string
toUpperCase() Returns a string converted to uppercase letters
trim() Returns a string with removed whitespaces
trimEnd() Returns a string with removed whitespaces from the end
trimStart() Returns a string with removed whitespaces from the start
valueOf() Returns the primitive value of a string or a string object

 

 

http://www.w3schools.com 발췌

 

String Templates까지 함. 

 

 

728x90
반응형

'JAVASCRIPT' 카테고리의 다른 글

20241122_1 Date Objects  (0) 2024.11.22
20241121_2 Arrays  (0) 2024.11.21
20241121_1 Numbers  (2) 2024.11.21
20241120_2 기초2  (2) 2024.11.20
20241120_1 기본  (6) 2024.11.20

+ Recent posts