JSFiddle - React, Tailwind, and code Playground
HTML
<button type="button" class="btn" name="showAllBtn" onclick="toggleFunction()">Show all</button>
JavaScript
function showAllSteps() {
alert('showAllSteps');
expectedFunc = function() { nextStep(); };
}
function nextStep() {
alert('nextStep');
expectedFunc = function() { showAllSteps(); };
}
function toggleFunction() {
expectedFunc();
}
var expectedFunc = function() { showAllSteps(); };