is there any way to store a function call in a var ? if so i could save a 100s of lines in my code

function heads(){
function tails(){
function banana(){
function apple(){

if (choice == 1){
var A = apple()
var B = banana()
if (choice == 2){
var A = heads()
var B = tails()

Dice = Math.ceil (Dice * 2)

if (Dice == 1){
else if (Dice == 2){

the point with this is i can just change what A and B = and reuse the "if Dice" otherwise i need to make an "if" for every time i want to run it with different thing
Disclaimer i know with only 2 vars there is not much point to this but any more and the script will be samaller by doing this