return string from javascript function
<script>
function showName() {
var result;
result = addString('Hello', ' World');
document.write (result );
}
// in below we will check how to return string from function
function addString(fName, lName) {
var val;
val = fName + lName;
return val; // returning string from function
}
</script>
<input type = "button" onclick = "showName()" value = "Result">
/*
I hope it will help you.
Namaste
Stay Home Stay Safe
*/function test(arg){
return arg;
}
Also in JavaScript:
- angular raw
- javascript check if var is string
- javascript object tostring
- como criar uam seessão com jsp
- uuid react native expo
- see all functions in a website with console
- multiline textinput in react native
- iterate array in javascrpt
- JS date year
- how to print to screen in javascript
- get object with max value javascript
- requir mongoose
- Aspect Ratio height react
- js wait for time
- array ub js
- moment parse string to date
- javascript to help find overflow elements
- comprimento string javascript
- javascript modal
- javascript is valid email
- socket io middleware
- python json string to object
- pseudo selector css
- jquery class selector