Quit Game button will not work

I am taking an online course in Unity. The game we are making uses premade scripts. I can’t get my quit button to work to end the game on either level. I have a GameOver canvas with a quit button, and the text on the button points to the quit game script, and the canvas is set to interactable, and points to the end game text and the correct script. No one else seems to be having this problem, and no one has answered my help request in the class message boards, so I am turning here for help.

Edited to add: it doesn’t work in either the preview or after I build it.

I don’t know how to do code - we learn how to use it next lesson. Basically, we were told to select a prewritten code from the provided scripts folder. I did see some answers to similar problems, but I haven’t yet learned what to do with the provided pieces of code.

It wouldn’t let me upload another picture to show the code, so I cut and pasted it (but I don’t think that’s the problem):

using UnityEngine;
using System.Collections;

public class UIButtonQuitGame : MonoBehaviour {

public void quitGame()
{
	//Closes the game
	Application.Quit();
}

}

void QuitGame()
{
#if UNITY_EDITOR
if (Application.isEditor)
UnityEditor.EditorApplication.isPlaying = false;
#endif
Application.Quit();
print(“退出游戏”);
}

Application.Quit() won’t work in the Editor. It will work in builds though. If you want to make sure that the function is indeed getting called in the Editor, you can add a Debug.Log to notify yourself.

 public void quitGame()
 {
     //Closes the game
     Debug.Log("game quitted");  // Confirmation that the function is being called.
     Application.Quit();  // This only works in builds, not in the Editor play modes.
 }