In t his example we present a number guessing game Example(s) function guessNumber() { // generating a random integer from 1 to 5 const random = Math.floor(Math.random() * 5) …
-
-
In this article we show you a program that will simulate the shuffling of a deck of cards Code (function () { var cardWeights = [“1”, “2”, “3”, …
-
The toUpperCase() method returns the value of the string converted to uppercase. This method does not affect the value of the string itself since JavaScript strings are immutable. Example …
-
-
-
In JavaScript, the reload() method is used to reload a webpage. It is similar to the refresh button of the browser. This method does not return any value. Syntax location.reload() …
-
The conditional (ternary) operator is the only JavaScript operator that takes three operands: a condition followed by a question mark (?), then an expression to execute if the condition is true followed …
-
In this example we compare 2 dates in C# Example We store a date in a variable and for the purpose of this example we add 30 days We then …
-
In this example we show you a way to count the amount of lines in a string Example We use a while loop to count the lines in string. We …
-
In this example we show you how to replace a string in another string in C# Example The Replace() function is used to change the word. It changes all occurrences …
-
In this example we will read the contents of a file in C# Example The ‘StreamReader’ is used to position the file pointer at the beginning of the file. We …
-
In this example we show copy the contents of one file into another in C# Example This example will take a file called testfile.txt and copy the contents to a …