Good way in javascript to have dynamic content using closure
Lets say, we have to use the string:
" content has been posted 1 times"
" content has been posted 2 times"
we can use below code
Cheers!!
Lets say, we have to use the string:
" content has been posted 1 times"
" content has been posted 2 times"
we can use below code
var message = function(count){ return " content has been posted " + count + times "; } console.log(message(1)); console.log(message(2));
Cheers!!