I have some JavaScript function like below:-
function temp() {
var rep ="some";
}
function solve() {
function temp();
$("#demo").text('solve1:'+rep);
}
function solve1() {
function temp();
$("#demo1").text('solve2:'+rep);
}
function solve2() {
function temp();
$("#demo2").text('solve3:'+rep);
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<p id="demo"></p>
<p id="demo1"></p>
<p id="demo2"></p>
<button onclick="solve()">solve</button><br>
<button onclick="solve1()">solve</button><br>
<button onclick="solve2()">solve</button><br>
My question is how to callback first function temp() into all other three functions. Above script is not working. How do I include one JavaScript function within multiple functions?
repis inside the function