Blogger is a platform where an aspiring writer can start their writing journey without much focus on technical things like domain names, hosting, etc. However, the default domain name provided by Blogger may not fully reflect the identity of your blog, and users may have a hard time remembering your blog URL. This guide illustrates the steps that you should follow to add a custom domain from Freenom to your blogger blog for FREE so that you can have a custom URL with zero cost which better reflects what your blog stands for.
Please note that the domains and blogs I’ve used below for illustrations have been deleted for privacy concerns, by the time you are reading this
Register a Custom Domain Name
First things first. Head over to Freenom.com and sign up for an account. After that, go to Register a New Domain under the Services dropdown.
Go to “Register a New Domain” under Services
Search for your domain to see if it’s available. Here, For example, I have searched for a better domain.
Search for your domain name to see if it’s available
Then, a set of results as follows should be displayed. Select the domain that you want, by clicking on the Get it now button next to the domain name. As shown in the following screenshot, I have selected the domain better domain. ml. Please note that sometimes, the domain name you want may be unavailable. In that case, unfortunately, you will have to pick up what’s been left or start over the whole process with another name you prefer.
After selecting the domains you want, click on Checkout.
Select the domain that you want
Now, you will see something as shown in the following image. You have to select the period for which you want your domain name for free. Here, I have selected 1 month for free. Don’t worry, you can always renew your domain when it’s about to be expired. After setting the preferred period, click Continue.
Select the period and press Continue
We have come to the final steps of ordering a custom domain now. Agree to their terms & conditions and click Complete Order.
Complete the order
To see the domain that you registered, select My Domains under the Services dropdown. You can see your domain is displayed there.
See your registered domain under “My Domains”
Since a domain name has been registered, now, it’s time to go to your blogger blog. Don’t forget that we have to come again here to set up DNS settings. Let’s come into that part later in this guide.
Add the Domain Name to Your Blogger Site
Go to the Settings of your blog and click on Custom Domain
Type in the domain name that we registered with Freenom (prefix it with www.), and click Save. Then you will encounter an error like below. This occurs because we haven’t set up DNS for our domain yet. If someone types in our custom domain, they should be redirected to our blogger blog. For that to happen, we need to add DNS records at the domain name provider’s site.
The error message itself describes it well
Manage Your Domain’s DNS Settings
Go to My Domains under Services dropdown and click on the Manage domain button, next to the domain name you registered.
Click on the “Manage domain” button, next to the domain name you registered.
Click on Manage Freenom DNS. Add two CNAME records as shown below. You can see that the name and target fields of the records are the strings that we were provided within the error message by Blogger. Don’t forget to select Type as CNAME, otherwise, it won’t work.
Add two CNAME records
Now we have finished setting up DNS for our domain name. It takes some time to take effect. In my case, it was for about an hour. Therefore, you have to wait for some time before completing the final steps of this process on your Blogger blog.
Final Work
Since we have set up DNS by now, go to Publishing under Settings → Basic of your blog, type the domain name prefixed with www, and click Save. It should be saved without giving any error.
If it’s not, please wait some more time as DNS settings may not have been taken effect yet.
There’s an additional step to complete. Some users of your blog might type your blog URL without the “www” part, for example, typing better domain. ml instead of www. better domain. ml. Therefore, you need to set up a redirect from better domains. ml to www. better domain. ml. To do that, click on Edit next to your new domain name and check the checkbox in the resulting form, as shown in the following images.
Click on “Edit”
Check this checkbox to setup redirect
Congratulations..you did it. You now have set up your blog, to access it with a custom domain name of your choice🥳.
Hooray!!! You did it
This article explained how to add a custom domain from Freenom to your Blogger blog for free. Feel free to comment below if you face any difficulty when following along. Share with your friends so that they may also benefit from this guide😊.
FilmoraGo is an easy-to-use, full-featured video editor loaded with powerful tools. With this video editor, making memes, creating videos with photos, pictures, music, sticker and sound effect is easy and fun, Editing videos for YouTube, Instagram, Tik Tok, Facebook, Messenger, Whatsapp, Twitter etc.
Our JavaScript Tutorial is designed for both beginners and professionals. JavaScript is used to create client-side dynamic pages.
JavaScript is an object-based scripting language that is lightweight and cross-platform.
JavaScript is not a compiled language, but it is a translated language. The JavaScript Translator (embedded in the browser) is responsible for translating the JavaScript code for the web browser.
What We Will Cover in this Article
(Click on Each Link or Click Next Button at the Bottom )
The JavaScript comments are a meaningful way to deliver the message. It is used to add information about the code, warnings, or suggestions so that end-user can easily interpret the code.
The JavaScript comment is ignored by the JavaScript engine i.e. embedded in the browser.
Advantages of JavaScript comments
There are mainly two advantages of JavaScript comments.
To make code easy to understand It can be used to elaborate the code so that end-user can easily understand the code.
To avoid unnecessary code It can also be used to avoid the code being executed. Sometimes, we add the code to perform some action. But after some time, there may be a need to disable the code. In such a case, it is better to use comments.
Types of JavaScript Comments
There are two types of comments in JavaScript.
Single-line Comment
Multi-line Comment
JavaScript Single line Comment
It is represented by double forward slashes (//). It can be used before and after the statement.
Let’s see the example of single-line comment i.e. added before the statement.
<script>
// It is single line comment
document.write("hello javascript");
</script>
Let’s see the example of single-line comment i.e. added after the statement.
<script>
var a=10;
var b=20;
var c=a+b;//It adds values of a and b variable
document.write(c);//prints sum of 10 and 20
</script>
JavaScript Multi line Comment
It can be used to add single as well as multi-line comments. So, it is more convenient.
It is represented by a forwarding slash with an asterisk then an asterisk with a forwarding slash. For example:
/* your code here */
It can be used before, after, and middle of the statement.
<script>
/* It is a multi-line comment.
It will not be displayed */
document.write("example of javascript multiline comment");
A JavaScript variable is simply a name of storage location. There are two types of variables in JavaScript: local variable and global variable.
There are some rules while declaring a JavaScript variable (also known as identifiers).
Name must start with a letter (a to z or A to Z), underscore( _ ), or dollar( $ ) sign.
After first letter we can use digits (0 to 9), for example value1.
JavaScript variables are case sensitive, for example x and X are different variables.
Correct JavaScript variables
var x = 10;
var _value="sonoo";
Incorrect JavaScript variables
var 123=30;
var *aa=320;
Example of JavaScript variable
Let’s see a simple example of JavaScript variable.
<script>
var x = 10;
var y = 20;
var z=x+y;
document.write(z);
</script>
Output of the above example
30
JavaScript local variable
A JavaScript local variable is declared inside block or function. It is accessible within the function or block only. For example:
<script>
function abc(){
var x=10;//local variable
}
</script>
Or,
<script>
If(10<13){
var y=20;//JavaScript local variable
}
</script>
JavaScript global variable
A JavaScript global variable is accessible from any function. A variable i.e. declared outside the function or declared with window object is known as global variable. For example:
<script>
var data=200;//gloabal variable
function a(){
document.writeln(data);
}
function b(){
document.writeln(data);
}
a();//calling JavaScript function
b();
</script>
JavaScript Global Variable
A JavaScript global variable is declared outside the function or declared with a window object. It can be accessed from any function.
Let’s see the simple example of global variable in JavaScript.
<script>
var value=50;//global variable
function a(){
alert(value);
}
function b(){
alert(value);
}
</script>
Declaring JavaScript global variable within the function
To declare JavaScript global variables inside the function, you need to use a window object. For example:
window.value=90;
Now it can be declared inside any function and can be accessed from any function. For example:
function m(){
window.value=100;//declaring global variable by window object
}
function n(){
alert(window.value);//accessing global variable from other function
}
Internals of a global variable in JavaScript
When you declare a variable outside the function, it is added to the window object internally. You can access it through the window object also. For example:
var value=50;
function a(){
alert(window.value);//accessing global variable
}
Javascript Data Types
JavaScript provides different data types to hold different types of values. There are two types of data types in JavaScript.
Primitive data type
Non-primitive (reference) data type
JavaScript is a dynamic type language, which means you don't need to specify the type of the variable because it is dynamically used by the JavaScript engine. You need to use var here to specify the data type. It can hold any type of value such as numbers, strings, etc. For example:
var a=40;//holding number
var b="Rahul";//holding string
JavaScript primitive data types
There are five types of primitive data types in JavaScript. They are as follows:
JavaScript non-primitive data types
The non-primitive data types are as follows:
JavaScript Operators
We will have a great discussion on each data type later.
JavaScript operators are symbols that are used to perform operations on operands. For example:
var sum=10+20;
Here, + is the arithmetic operator, and = is the assignment operator.
There are the following types of operators in JavaScript.
Arithmetic Operators
Comparison (Relational) Operators
Bitwise Operators
Logical Operators
Assignment Operators
Special Operators
JavaScript Arithmetic Operators
Arithmetic operators are used to performing arithmetic operations on the operands. The following operators are known as JavaScript arithmetic operators.
JavaScript Comparison Operators
The JavaScript comparison operator compares the two operands. The comparison operators are as follows:
JavaScript Bitwise Operators
The bitwise operators perform bitwise operations on operands. The bitwise operators are as follows:
JavaScript Logical Operators
The following operators are known as JavaScript logical operators.
JavaScript Assignment Operators
The following operators are known as JavaScript assignment operators.
JavaScript Special Operators
The following operators are known as JavaScript special operators.
JavaScript If-else
The JavaScript if-else statement is used to execute the code whether the condition is true or false. There are three forms of if statement in JavaScript.
If Statement
If else statement
if-else if statement
JavaScript If statement
It evaluates the content only if the expression is true. The signature of the JavaScript if statement is given below.
if(expression){
//content to be evaluated
}
Flowchart of JavaScript If statement
Let’s see the simple example of if statement in javascript.
<script>
var a=20;
if(a>10){
document.write("value of a is greater than 10");
}
</script>
The output of the above example
value of a is greater than 10
JavaScript If...else Statement
It evaluates the content whether the condition is true or false. The syntax of the JavaScript if-else statement is given below.
if(expression){
//content to be evaluated if the condition is true
}
else{
//content to be evaluated if condition is false
}
Flowchart of JavaScript If...else statement
Let’s see the example of if-else statement in JavaScript to find out the even or odd number.
<script>
var a=20;
if(a%2==0){
document.write("a is even number");
}
else{
document.write("a is odd number");
}
</script>
The output of the above example
a is even number
JavaScript If...else if statement
It evaluates the content only if the expression is true from several expressions. The signature of JavaScript if else if statement is given below.
if(expression1){
//content to be evaluated if expression1 is true
}
else if(expression2){
//content to be evaluated if expression2 is true
}
else if(expression3){
//content to be evaluated if expression3 is true
}
else{
//content to be evaluated if no expression is true
}
Let’s see the simple example of if else if statement in javascript.
<script>
var a=20;
if(a==10){
document.write("a is equal to 10");
}
else if(a==15){
document.write("a is equal to 15");
}
else if(a==20){
document.write("a is equal to 20");
}
else{
document.write("a is not equal to 10, 15 or 20");
}
</script>
The output of the above example
a is equal to 20
JavaScript Switch
The JavaScript switch statement is used to execute one code from multiple expressions. It is just like else if statement that we have learned on the previous page. But it is convenient than if..else.if because it can be used with numbers, characters, etc.
The signature of JavaScript switch statement is given below.
switch(expression){
case value1:
code to be executed;
break;
case value2:
code to be executed;
break;
......
default:
code to be executed if the above values are not matched;
}
Let’s see the simple example of switch statement in javascript.
<script>
var grade='B';
var result;
switch(grade){
case 'A':
result="A Grade";
break;
case 'B':
result="B Grade";
break;
case 'C':
result="C Grade";
break;
default:
result="No Grade";
}
document.write(result);
</script>
Output of the above example
B Grade
The switch statement is fall-through i.e. all the cases will be evaluated if you don't use break statement.
Let’s understand the behaviour of switch statement in JavaScript.
<script>
var grade='B';
var result;
switch(grade){
case 'A':
result+=" A Grade";
case 'B':
result+=" B Grade";
case 'C':
result+=" C Grade";
default:
result+=" No Grade";
}
document.write(result);
</script>
Output of the above example
B Grade B Grade C Grade No Grade
JavaScript Loops
The JavaScript loops are used to iterate the piece of code using for, while, do-while, or for-in loops. It makes the code compact. It is mostly used in the array.
There are four types of loops in JavaScript.
for loop
while loop
do-while loop
for-in loop
1) JavaScript For loop
The JavaScript for loopiterates the elements for a fixed number of times. It should be used if several iterations are known. The syntax of for loop is given below.
for (initialization; condition; increment)
{
code to be executed
}
Let’s see the simple example of for loop in javascript.
<script>
for (i=1; i<=5; i++)
{
document.write(i + "<br/>")
}
</script>
Output:
1 2 3 4 5
2) JavaScript while loop
The JavaScript while loopiterates the elements for an infinite number of times. It should be used if several iterations are not known. The syntax of the while loop is given below.
while (condition)
{
code to be executed
}
Let’s see the simple example of while loop in javascript.
<script>
var i=11;
while (i<=15)
{
document.write(i + "<br/>");
i++;
}
</script>
Output:
11 12 13 14 15
3) JavaScript do-while loop
The JavaScript do-while loopiterates the elements for an infinite number of times like a while loop. But, code is executed at least once whether the condition is true or false. The syntax of the do-while loop is given below.
do{
code to be executed
}while (condition);
Let’s see the simple example of do while loop in javascript.
<script>
var i=21;
do{
document.write(i + "<br/>");
i++;
}while (i<=25);
</script>
Output:
21 22 23 24 25
4) JavaScript for-in loop
The JavaScript for-in loop is used to iterate the properties of an object. We will discuss it later.
JavaScript Functions
JavaScript functions are used to perform operations. We can call the JavaScript function many times to reuse the code.
Advantage of JavaScript function
There are mainly two advantages of JavaScript functions.
Code reusability: We can call a function several times so it saves coding.
Less coding: It makes our program compact. We don’t need to write many lines of code each time to perform a common task.
JavaScript Function Syntax
The syntax of declaring function is given below.
function functionName([arg1, arg2, ...argN]){
//code to be executed
}
JavaScript Functions can have 0 or more arguments.
JavaScript Function Example
Let’s see the simple example of function in JavaScript that does not has arguments.