Below javascript code will create the helloWorld variable as a singleton
<script type=”text/javascript”>
var helloWorld = new function() {
this.hello = {
sayHi : function() {
alert(“Hello World”);
}
};
}();
</script>
In order to access the alert method inside that variable, all you need is to use the dot notation…
var sayHitotheworld = new helloWorld.hello.sayHi();
now click on the below button to see the outcome…
Next Page :
How to use Java Scanner ClassThis article will show you how to use Java Scanner Class with simple Java code.
Show text on JFrame with Java programShow text on JFrame with Java program!
The if…else statement in Java program‘The if…else statement in Java program’ article will show you an example to use the statement.
Java Scanner ClassJava Scanner class tutorial will show you how to create an instance of the scanner class and read in the input from the user then print out the sum of those inputs.
Creating and Using Interfaces in Java ProgramCreating and Using Interfaces in Java Program will show you how to write simple java program using Interfaces.
Create a simple Java methodAn article about how to create a simple Java method.
