How to return a string from a JavaScript function?

Today, We want to share with you javascript function return string.In this post we will show you Returning a strings in Javascript, hear for how to get value from one function to another in javascript? we will give you demo and example for implement.In this post, we will learn about JavaScript Functions with an example.

how to return strings from javascript function?

Example 1: return strings from javascript function

<script>
function printDisplayNm() {
  var response;
  response = addString('Welcome', ' Zakhi');
  document.write (response );
}


function addString(membername, sirname) {
  var val;
  val = membername + sirname;
  return val;  // returning strings from function
}
</script>
<input type = "button" onclick = "printDisplayNm()" value = "Result">
  
/*
We hope it will help you as well as fine.
Welcome To Pakainfo
Stay Home Stay Safe
*/

return statement javascript

Example 2:

function check_content(arg){
    return arg;
}

We hope you get an idea about calling javascript function from php code.
We would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donโ€™t forget to share.