Answers for "functions in js"

PHP
1

startsWith() and endsWith() functions in PHP

function startsWith($haystack, $needle)
{
     $length = strlen($needle);
     return (substr($haystack, 0, $length) === $needle);
}

function endsWith($haystack, $needle)
{
    $length = strlen($needle);
    if ($length == 0) {
        return true;
    }

    return (substr($haystack, -$length) === $needle);
}
Posted by: Guest on May-18-2020
12

declare function javascript

function myFunction(var1, var2) {
  return var1 * var2;
}
Posted by: Guest on February-05-2020
1

javascript function

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Functions</h2>

<p>calculator function example</p>

<label>Result:</label>

<p id="fnc"></p>

<script>
function myFunction(p1, p2) {
  return p1 * p2;
}
document.getElementById("fnc").innerHTML = myFunction(2, 3);
</script>

</body>
</html>
Posted by: Guest on August-10-2021
4

javascript function

// variable:
var num1;
var num2;
// function:
function newFunction(num1, num2){
	return num1 * num2;
}
Posted by: Guest on November-03-2020
1

javascript function

function myFunction(){
  document.write("Hello World!")
}
myFunction();
Posted by: Guest on September-02-2021
1

functions in javascript

function name( parameter1 ,parameter 2,..)  //name signifies funcname
{
    
}
Posted by: Guest on April-03-2021

Browse Popular Code Answers by Language