Corge.dev

JavaScript

topic name here

note here

String

Returns the number of characters in a string

Basic Example
Password Strength

finds the first occurrence from the beginning.

Basic

finds the last occurrence from the end.

Extracts from 'start' up to (but not including) 'end'

Similar to slice, but cannot handle negative indexes.

Extracts a 'length' number of characters starting at 'start'.

Convert a string to lowercase.

Convert a string to uppercase.

Remove whitespace from the beginning and end of a string.

Remove whitespace from the beginning of a string.

Remove whitespace from the end of a string.

Combine two or more strings

Replace parts of a string with a new substring

Replace parts of a string with a new substring

Uses regular expressions to search for patterns within a string

split a string to an array

Check if one string exists within another

Check if a string begins with specific characters

Check if a string ends with specific characters

Finds the index of the first occurrence of a substring

Creates a new string by repeating your original string a specified number of times

Add specified char at start

Add specified char at end

Number

Convert other types to number

parses an argument and returns a floating point number

parses a string argument and returns an integer.

formats this number using fixed-point notation.

returns a string representing this number in exponential notation

returns a string with a language-sensitive representation of this number.

returns a string representing this number to the specified precision.

determines if value is a finite number

Basic Example

determines whether the passed value is an integer.

determines whether the passed value is Not a number.

returns the value of this number

Object

turns the input into an object

copies properties from one or more source objects to a target object

creates a new object, using an existing object

useless

useless

returns an array of a given object's own string-keyed property key-value pairs

transforms a list of key-value pairs into an object

returns an object describing the configuration of a specific property on a given object

determines whether two values are the same value

Array

number of elements

returns the item at that index

merge two or more arrays

shallow copies part of this array to another.

new array iterator object that contains the key/value pairs for each index in the array

tests whether all elements in the array pass the test

changes all elements within a range of indices in an array to a static value. It returns the modified array.

filter array by the callbackfn.

find first element by the callbackfn

returns the index of the first element in an array that satisfies the provided testing function.

iterates the array in reverse order and returns the value of the first element that satisfies the provided testing function.

iterates the array in reverse order and returns the index of the first element that satisfies the provided testing function

creates a new array with all sub-array elements concatenated into it recursively up to the specified depth

returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level.

executes a provided function once for each array element

creates a new, shallow-copied Array instance from an iterable or array-like object.

creates a new, shallow-copied Array instance from an async iterable, iterable, or array-like object.

determines whether an array includes a certain value among its entries, returning true or false

returns the first index at which a given element can be found in the array, or -1 if it is not present.

determines whether the passed value is an Array.

creates and returns a new string by concatenating all of the elements in this array, separated by commas or a specified separator string

instances returns a new array iterator object that contains the keys for each index in the array.

returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex.

creates a new array populated with the results of calling a provided function on every element in the calling array

creates a new Array instance from a variable number of arguments, regardless of number or type of the arguments

removes the last element from an array and returns that element. This method changes the length of the array

adds the specified elements to the end of an array and returns the new length of the array.

combines array elements into one value using a provided function

combines array elements (right-to-left) into a single value.

reverses the order of elements within an array, modifying it directly.

removes the first array element and returns it

extracts a portion of an array into a new array, leaving the original unchanged

method tests if at least one array element matches a provided condition.

rearranges array elements in place, typically in ascending order.

method directly modifies an array by removing, replacing, or adding elements

method formats array elements into a localized string with separators.

method creates a new array with elements in reversed order, leaving the original array unchanged

method creates a sorted copy of an array without modifying the original

creates a new array after removing/replacing elements, leaving the original array unchanged

converts an array into a comma-separated string.

method adds elements to the start of an array and returns the new length

provides an iterator for an array's values

creates a copy of an array, replacing the element at a specified index with a new value

Date

returns the day of the month for this date according to local time.

returns the day of the week for this date

returns the year for this date

returns the hours for this date

returns the milliseconds for this date

returns the minutes for this date

returns the month for this date

returns the seconds for this date

returns the number of milliseconds for this date since the epoch

returns the difference, in minutes

returns the day of the month for this date (universal time)

returns the day of the week for this date (universal time)

returns the year for this date (universal time)

returns the hours for this date (universal time)

returns the milliseconds for this date (universal time)

returns the minutes for this date (universal time)

returns the month for this date (universal time)

returns the seconds in the specified date (universal time)

returns the number of milliseconds elapsed since the epoch

parses a string representation of a date, and returns the date's timestamp

changes the day of the month for this

changes the year, month, and/or day of month for this date

modifies a date object's hours/time based on local time

changes the milliseconds for this date

changes the minutes for this date

changes the month and/or day of the month for this date

changes the seconds and/or milliseconds for this date

changes the timestamp for this date

changes the day of the month for this date UTC

changes the year for this date UTC

changes the hours, minutes, seconds, and/or milliseconds for this date

changes the milliseconds for this date UTC

changes the minutes for this date UTC

changes the month and/or day of the month for this date UTC

changes the seconds and/or milliseconds for this date

returns a string representing the date

returns a string in the date time string format

returns a string ISO format

formats a date according to the user's locale

provides a locale-aware date/time representation

returns a locale-sensitive time string

returns a string representing this date

returns a string representing the time portion of this date

converts a date to a UTC-formatted string (RFC 7231)

returns a timestamp in milliseconds, treating input as UTC

returns a date's primitive representation as milliseconds

Functions

Pure Functions

Anchor element

Basic Example

note

Predictable, always produce the same output for the same input. No side effects (modifying external state, network requests, etc.). Easier to reason about and test.

Impure Functions

Can have side effects

Basic Example

note

Changing global variables Interacting with the DOM Performing I/O operations (files, network) Generating random numbers

Helper Functions

Can have side effects

Basic Example

note

Small, focused functions that encapsulate specific tasks. Improve readability and maintainability.

Event Handlers

Can have side effects

Basic Example

note

Respond to user interactions (clicks, form submissions, etc.) or system events. Often change application state or trigger updates.

Asynchronous Functions

Can have side effects

Basic Example

note

Handle operations that take time to complete (network requests, timers). Use promises or the async/await syntax for cleaner handling of results.

Higher-Order Functions

Can have side effects

Basic Example

note

Take other functions as arguments or return them as results. Powerful for abstraction and functional programming patterns. Examples: map (applies a function to each element of an array) filter (creates a new array with elements that pass a condition) reduce (aggregates array values into a single value)