JS

console.log('Hello World');

What is JavaScript

JavaScript is a lightweight, interpreted programming language. It is designed for creating network-centric applications. It is complimentary to and integrated with Java. JavaScript is very easy to implement because it is integrated with HTML. It is open and cross-platform.

Why to Learn Javascript

Javascript is a MUST for students and working professionals to become a great Software Engineer specially when they are working in Web Development Domain. I will list down some of the key advantages of learning Javascript:

  • Javascript is the most popular programming language in the world and that makes it a programmer’s great choice. Once you learnt Javascript, it helps you developing great front-end as well as back-end softwares using different Javascript based frameworks like jQuery, Node.JS etc.

  • Javascript is everywhere, it comes installed on every modern web browser and so to learn Javascript you really do not need any special environment setup. For example Chrome, Mozilla Firefox , Safari and every browser you know as of today, supports Javascript.

  • Javascript helps you create really beautiful and crazy fast websites. You can develop your website with a console like look and feel and give your users the best Graphical User Experience.

  • JavaScript usage has now extended to mobile app development, desktop app development, and game development. This opens many opportunities for you as Javascript Programmer.

  • Due to high demand, there is tons of job growth and high pay for those who know JavaScript. You can navigate over to different job sites to see what having JavaScript skills looks like in the job market.

Great thing about Javascript is that you will find tons of frameworks and Libraries already developed which can be used directly in your software development to reduce your time to market.

JavaScript Frameworks

  • Angular

  • React

  • jQuery

  • Vue.js

  • Ext.js

  • Ember.js

  • Meteor

  • Mithril

  • Node.js

  • Polymer

  • Aurelia

  • Backbone.js

Applications of Javascript

As mentioned before, Javascript is one of the most widely used programming languages (Front-end as well as Back-end). It has it's presence in almost every area of software development. I'm going to list few of them here:

Client side validation - This is really important to verify any user input before submitting it to the server and Javascript plays an important role in validting those inputs at front-end itself.

Manipulating HTML Pages - Javascript helps in manipulating HTML page on the fly. This helps in adding and deleting any HTML tag very easily using javascript and modify your HTML to change its look and feel based on different devices and requirements.

User Notifications - You can use Javascript to raise dynamic pop-ups on the webpages to give different types of notifications to your website visitors.

Back-end Data Loading - Javascript provides Ajax library which helps in loading back-end data while you are doing some other processing. This really gives an amazing experience to your website visitors.

Presentations - JavaScript also provides the facility of creating presentations which gives website look and feel. JavaScript provides RevealJS and BespokeJS libraries to build a web-based slide presentations.

Server Applications - Node JS is built on Chrome's Javascript runtime for building fast and scalable network applications. This is an event based library which helps in developing very sophisticated server applications including Web Servers.

This list goes on, there are various areas where millions of software developers are happily using Javascript to develop great websites and others softwares.

Js IDE

  • Visual Studio: an industry-standard software

  • Visual Studio Code. A free version: lighter on the features; high in value

  • Webstorm. A premium JavaScript development environment

  • Atom. A strong contender for the best free JavaScript IDE

  • Sublime Text. Freemium entry into the text editor market

  • Eclipse. An IDE with a good work environment feature

  • NetBeans. A powerful code monitoring tool

Js Math Library

Math.PI

Ratio of a circle's circumference to its diameter; approximately 3.14159.

Math.abs()

Returns the absolute value of x.

Math.ceil()

Returns the smallest integer greater than or equal to x.

Math.exp()

Returns ex, where x is the argument, and e is Euler's number (2.718…, the base of the natural logarithm).

Math.floor()

Returns the largest integer less than or equal to x.

Math.log()

Returns the natural logarithm (㏒e; also, ㏑) of x.

Math.max()

Returns the largest of zero or more numbers.

Math.min()

Returns the smallest of zero or more numbers.

Math.pow()

Returns base x to the exponent power y (that is, xy).

Math.random()

Returns a pseudo-random number between 0 and 1.

Math.round()

Returns the value of the number x rounded to the nearest integer.

Math.sqrt()

Returns the positive square root of x.

Js Variable

string

function

var console.log() loop(for, while) conditional(If-else) switch array for of indexof array.length recursion debug

Recursion

Object

Practice Problems

  • The function should be named anaToVori : A function that takes ana (ana) as a parameter. Then convert it to full and return the number of values. Will just return the number


function anaToVori(ana)
{
    var vori = (ana * 1) / 16; 
    return vori;
}
var ana = [1, 2, 5, 7, 9, 10]
for (var i = 0; i < ana.length; i++)
{
    var anaa = ana[i];

    var result = anaToVori(anaa);
    console.log(result);
}


  • [Function name should be pandaCost]: Three parameters are required. Will watch the video.

    Price of 1 Singara – 7 Tk

    Price of 1 Samucha – 10 Tk

    Price of 1 Jilapi – 15 Tk

Now if he orders different numbers of Singara, Samucha, and Jilapi, then the total cost will be returned.



function pandaCost(singara, somucha, jilapi)
{

    var singraPrice = 7 * singara;
    var somuchaPrice = 10 * somucha;
    var jilapiPrice = 15 * jilapi;

    var total = singraPrice + somuchaPrice + jilapiPrice;

    return total;
}

var singara = 5;
somucha = 5;
jilapi = 10;


var result = pandaCost(singara, somucha, jilapi);

console.log(result);


  • [ Function name should be picnicBudget]: The number of people who will go to the picnic will be taken as a parameter.

    If 100 or less then it will cost Rs 5000 each. If more than 100 but less than or equal to 200, then 5000 should be paid for each of the first 100 people. And those who have more than 100 (ie from number 101) have to pay 4000 rupees for each of them. And if more than 200, then 5000 rupees should be paid for each of the first 100 people. And those who have more than 100 have to pay 4000 rupees for each of them. Those who have more than 200 (ie from number 201) have to pay 3000 rupees for each. Now I will give a parameter. It can be any number. Based on that number, you return from the function how much the picnic budget should be. The number of input parameters can be less than 100. May be between 100 and 200. It can be more than 200. So all cases will be tested well.



function picnicBudget(members)
{

    if (members < 100)
    {
        var totalCost = members * 5000;
        
        return totalCost;
    }
    
    else if (members > 100 && members <= 200)
    {
        var lessThanHundread = members - 100;
        var costLessThanHundread = lessThanHundread * 4000;
        var greaterThanHundread = 100 * 5000;
        var totalCost = costLessThanHundread + greaterThanHundread;
        return totalCost;

    }
    
    else
    {
        var firstHundread = 100 * 5000;
        var restOfTheHundread = 100 * 4000;
        var lastPeople = (members - 200) * 3000;
        var totalCost = firstHundread + restOfTheHundread+lastPeople;
        return totalCost;


        }
}

var members = 250;
var result = picnicBudget(members);
console.log(result);


  • Even & Odd numbers finding

  • Factorial with for loop and Function

  • Leap year calculation with function

  • Unit convert inch to feet and miles to kilometer with function

  • Convert celsius to fahrenheit and fahrenheit to celsius with function

  • Grade calculation(Example-90=A+, 80=B, 77=B-, 60=P)

Integrate javascript

License

MIT LICENSE.md

Conclusion