DEV Community

avinash-repo
avinash-repo

Posted on

js 100 most used

It seems there might be a slight misunderstanding in your request. If you are looking for a list of commonly used JavaScript methods or functions that developers frequently use, rather than a specific count of 100 methods, here is a list of highly utilized methods in JavaScript:

  1. document.getElementById(): Retrieves an element by its ID.
  2. document.querySelector(): Returns the first element that matches a specified CSS selector.
  3. document.createElement(): Creates a new HTML element.
  4. addEventListener(): Attaches an event handler to an element.
  5. querySelectorAll(): Returns a static NodeList representing a list of elements.
  6. getElementByClassName(): Returns a collection of elements with the given class name.
  7. getElementByTagName(): Returns a live HTMLCollection of elements with the given tag name.
  8. innerHTML: Gets or sets the HTML content within an element.
  9. textContent: Gets or sets the text content of a node and its descendants.
  10. setAttribute(): Sets the value of an attribute on the specified element.
  11. removeAttribute(): Removes the specified attribute from an element.
  12. classList: Provides methods to manipulate the class attributes of an element.
  13. appendChild(): Appends a node as the last child of a node.
  14. removeChild(): Removes a child node from the DOM.
  15. parentNode: Returns the parent node of a specified node.
  16. nextSibling: Returns the next node at the same hierarchical level.
  17. previousSibling: Returns the previous node at the same hierarchical level.
  18. console.log(): Outputs a message to the console.
  19. alert(): Displays an alert dialog with a specified message.
  20. confirm(): Displays a dialog box with a specified message and OK/Cancel buttons.
  21. prompt(): Displays a dialog box that prompts the user for input.
  22. setTimeout(): Calls a function or evaluates an expression after a specified number of milliseconds.
  23. setInterval(): Calls a function or evaluates an expression at specified intervals.
  24. clearTimeout(): Clears the timeout set by setTimeout().
  25. clearInterval(): Clears the interval set by setInterval().
  26. localStorage: Provides a way to store key/value pairs locally.
  27. sessionStorage: Similar to localStorage but scoped to a session.
  28. JSON.parse(): Parses a JSON string, converting it to a JavaScript object.
  29. JSON.stringify(): Converts a JavaScript object into a JSON string.
  30. Array.isArray(): Checks if a value is an array.
  31. Array.from(): Creates a new array from an array-like or iterable object.
  32. Array.push(): Adds one or more elements to the end of an array.
  33. Array.pop(): Removes the last element from an array.
  34. Array.shift(): Removes the first element from an array.
  35. Array.unshift(): Adds one or more elements to the beginning of an array.
  36. Array.splice(): Adds or removes elements from an array.
  37. Array.slice(): Returns a shallow copy of a portion of an array.
  38. Array.concat(): Combines two or more arrays.
  39. Array.reverse(): Reverses the order of the elements in an array.
  40. Array.sort(): Sorts the elements of an array.
  41. Array.indexOf(): Returns the first index at which a given element is found in the array.
  42. Array.lastIndexOf(): Returns the last index at which a given element is found in the array.
  43. Array.includes(): Determines whether an array includes a specific element.
  44. Array.map(): Creates a new array by applying a function to each element.
  45. Array.filter(): Creates a new array with elements that satisfy a condition.
  46. Array.reduce(): Applies a function to reduce an array to a single value.
  47. Array.forEach(): Executes a provided function once for each array element.
  48. Array.every(): Checks if all elements in an array pass a test.
  49. Array.some(): Checks if at least one element in an array passes a test.
  50. String.length: Returns the length of a string.
  51. String.charAt(): Returns the character at a specified index in a string.
  52. String.concat(): Combines two or more strings.
  53. String.indexOf(): Returns the index of the first occurrence of a specified value in a string.
  54. String.lastIndexOf(): Returns the index of the last occurrence of a specified value in a string.
  55. String.slice(): Extracts a section of a string and returns a new string.
  56. String.substring(): Returns a subset of a string between two specified indices.
  57. String.substr(): Returns the characters in a string beginning at a specified location.
  58. String.replace(): Replaces a specified value or pattern with another value in a string.
  59. String.toUpperCase(): Converts a string to uppercase.
  60. String.toLowerCase(): Converts a string to lowercase.
  61. String.trim(): Removes whitespace from both ends of a string.
  62. String.split(): Splits a string into an array of substrings based on a specified delimiter.
  63. String.match(): Searches a string for a specified pattern and returns the matches.
  64. String.search(): Searches a string for a specified value or regular expression.
  65. String.includes(): Checks if a string contains another string.
  66. String.startsWith(): Checks if a string starts with a specified value.
  67. String.endsWith(): Checks if a string ends with a specified value.
  68. String.repeat(): Returns a new string repeated a specified number of times.
  69. String.padStart(): Pads a string with a specified character until it reaches a specified length.
  70. String.padEnd(): Pads a string's end with a specified character until it reaches a specified length.
  71. Number.parseInt(): Parses a string argument and returns an integer.
  72. Number.parseFloat(): Parses a string argument and returns a floating-point number.
  73. Number.isNaN(): Determines whether a value is NaN.
  74. Number.isFinite(): Determines whether a value is a finite number.
  75. Number.MAX_VALUE: Represents the maximum numeric value representable in JavaScript.
  76. Number.MIN_VALUE: Represents the minimum positive numeric value representable in JavaScript.
  77. Math.random(): Returns a random floating-point number between 0 (inclusive) and 1 (exclusive).
  78. Math.round(): Rounds a number to the nearest integer.
  79. Math.floor(): Rounds a number down to the nearest integer.
  80. Math.ceil(): Rounds a number up to the nearest integer.
  81. Math.abs(): Returns the absolute value of a number.
  82. Math.pow(): Raises a number to the power of another number.
  83. Math.sqrt(): Returns the square root of a number.
  84. Math.min(): Returns the smallest of zero or more numbers.
  85. Math.max(): Returns the largest of zero or more numbers.
  86. Math.sin(): Returns the sine of a number.
  87. **Math.cos

():** Returns the cosine of a number.

  1. Math.tan(): Returns the tangent of a number.
  2. Math.PI: Represents the mathematical constant π (pi).
  3. Math.E: Represents the mathematical constant e.
  4. Math.log(): Returns the natural logarithm of a number.
  5. Math.exp(): Returns the value of e raised to the power of a number.
  6. Math.random(): Returns a pseudo-random number between 0 and 1.
  7. Date(): Creates a new Date object representing the current date and time.
  8. Date.now(): Returns the current timestamp.
  9. Date.getFullYear(): Returns the year of a Date object.
  10. Date.getMonth(): Returns the month of a Date object (0-11).
  11. Date.getDate(): Returns the day of the month of a Date object.
  12. Date.getHours(): Returns the hour of a Date object (0-23).
  13. Date.getMinutes(): Returns the minutes of a Date object.

These methods and functions are commonly used in JavaScript for various tasks, ranging from DOM manipulation to string and array operations.

Top comments (0)