String variable returned object in Javascript -


i have problem variable string return [object object]

$(document).ready(function () {     $(".story-area > h1").text(function () {         return $(this).text(convertstring($(this).text()));     });      $(".story-area > p").text(function () {         return $(this).text(convertstring($(this).text()));     });      $(".story-area > div > p").text(function () {         return $(this).text(convertstring($(this).text()));     }); });   function convertstring(current_text) {     var arr_text = current_text.split(' ');     var new_text = '';     (i = 0; < arr_text.length; i++) {         if (arr_text[i].length > 4) {             new_text += arr_text[i].replace(/[hh][ii]/g, 'hiv') + ' ';         } else {             new_text += arr_text[i] + ' ';         }     }     return new_text; } 

the new_text value returns [object object] instead of string value. errors on code?

enter image description here

ah, setting text inside of setting text! treating text() each.

$(".story-area > h1").text(function () {     return convertstring($(this).text()); }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -