My guess is that the code that’s calling your trim
function is not actually passing a string to it.
To fix this, you can make str
a string, like this: str.toString().replace(...)
…as alper pointed out below.
Related Posts:
- What does “javascript:void(0)” mean?
- For-each over an array in JavaScript
- Cannot read property ‘push’ of undefined when combining arrays
- How can I remove a specific item from an array?
- require is not defined? Node.js
- What does “res.render” do, and what does the html file look like?
- How to pause javascript code execution for 2 seconds [duplicate]
- Getting Error “Form submission canceled because the form is not connected”
- How to implement navbar using react
- function updateMap for Google Maps API
- Loop inside React JSX
- Encode URL in JavaScript?
- JavaScript null check
- JavaScript “Uncaught TypeError: object is not a function” associativity question
- npm – EPERM: operation not permitted on Windows
- Module not found can’t resolve
- How can I get file extensions with JavaScript?
- How to detect Safari, Chrome, IE, Firefox and Opera browser?
- What does on() in JavaScript do?
- AngularJS : Factory and Service?
- What’s the difference between console.dir and console.log?
- scrollIntoView Scrolls just too far
- Javascript Uncaught TypeError : .split is not a function
- Uncaught TypeError: Cannot read property ‘msie’ of undefined
- How to hide a div with jQuery?v
- How do I pass variables and data from PHP to JavaScript?
- How do I set/unset a cookie with jQuery?
- Calling onclick on a radiobutton list using javascript
- How to properly export an ES6 class in Node 4?
- Uncaught Typeerror: cannot read property ‘innerHTML’ of null
- DOMException: Failed to load because no supported source was found
- Counting the occurrences / frequency of array elements
- how to download file in react js
- TypeError: $(…).DataTable is not a function
- Trying to use fetch and pass in mode: no-cors
- Moment.js transform to date object
- jQuery explode string like PHP
- Call Javascript function from URL/address bar
- Anagrams finder in javascript
- Validate date in dd/mm/yyyy format using JQuery Validate
- Javascript onload not working
- How to parse float with two decimal places in javascript?
- Checking for duplicate strings in JavaScript array
- How to get current date in jQuery?
- Print the contents of a DIV
- Remove all special characters except space from a string using JavaScript
- How to Scroll Down – JQuery
- How can I use webpack with express?
- JavaScript check if variable exists (is defined/initialized)
- What does the .subscribe() function do?
- is there something like isset of php in javascript/jQuery?
- jQuery – Dynamically Create Button and Attach Event Handler
- Highlight a word with jQuery
- Javascript: ‘window’ is not defined
- How to reload page every 5 seconds?
- How do I handle newlines in JSON?
- Update style of a component onScroll in React.js
- Fire oninput event with jQuery
- javascript includes() case insensitive
- Reading local text file into a JavaScript array
- “NS_ERROR_DOM_BAD_URI: Access to restricted URI denied”
- How can I unset a JavaScript variable?
- D3.js: what is ‘g’ in .append(“g”) D3.js code?
- Reset Undo on the tinymce editor
- Combine enqueue js without affecting dependencies
- Detecting WordPress Customizer Panel
- WP Customizer set a value via javascript (to create presets)
- Customizer – instantiating settings and controls via javascript
- How do I enqueue(or delay loading of) tags in individual page posts?
- JavaScript in page doesn’t open new window [closed]
- wp_enqueue_script adds only the first script
- Add javascript to a woocommerce page template
- Dynamically insert values in a WordPress SelectControl Options field
- Vimeo froogaloop
- can a buttongroup have a label?
- Preloader for a WordPress Site
- Trying to integrate Zoho Campaign Form [closed]
- InnerBlocks restricting does not work on nested blocks
- How to open the add media dialogue it in a certain state / tab?
- How to execute Javascript on a WordPress page?
- Removing auto versioning of JS and loading to header
- Gutenberg select excerpt, use generated excerpt or use more block excerpt
- Unable To Call Javascript With Enqueue
- How to integrate a JS fiddle?
- Hovercards and other hover over image functions don’t work anymore!
- How WP does Mortgage affordability calculation
- Putting custom html/js page into Elementor as it’s own block
- Drag-to-Scroll Landingpage
- Easiest way to find JS conflicts
- Nothing in dashboard that uses javascript works
- java console error about touch navigation
- Update block once an API request returns with a value
- How to improve WP-Rest atrocious response time?
- XMLHttpRequest of admin data to public
- How do I add a class to Customizer preview based on class of Customizer control? (Customizer Javascript API)
- Open image gallery on link click
- WordPress 4.2 mce-views migration guide?
- Loaded JavaScript file not showing [duplicate]
- PHP or JS for header image rotator?
- Use add_action to run a script, but only on the post editor page