Sorry For Inconvenience, Site is Under Maintenance. Please Goto HomePage

Javascript Essentials FP Handson Answers

Javascript Essentials FP Handson Answers
Notes Bureau

Javascript Essentials FP Handson Answers

Disclaimer: The main motive to provide this solution is to help and support those who are unable to do these courses due to facing some issue and having a little bit lack of knowledge. All of the material and information contained on this website is for knowledge and education purposes only.

Try to understand these solutions and solve your Hands-On problems. (Not encourage copy and paste these solutions)
Javascript Essentials FP Handson Answers

Course Path: Modern Web Development/WEB BASICS/Javascript Essentials


1.Try-it-out - Function for Fibonacci Series
Welcome to To generate Fibonacci sequence new

process.stdin.resume();
process.stdin.setEncoding('utf-8');

var __input_stdin = "";
var __input_stdin_array = "";
var __input_currentline = 0;

process.stdin.on('data', function(data) {
    __input_stdin += data;
});

/*
 * Complete the function below.
 */
function fibonacciSequence(input) {
    //Type your code here.
        var n1=0;
        var n2=1;
        var out=[];
        if(input==1)
            out.push(n1);
        else if(input==2)
            out.push(n1,n2);
        else{
            out.push(n1,n2);
            for(var i=0;i<=input-2;i++){
                var n3=n2+n1;
                n1=n2;
                n2=n3;
                out.push(n3);
            }
        }
        return out;
}
var fs = require('fs');
var wstream = fs.createWriteStream(process.env.OUTPUT_PATH);

process.stdin.on('end', function() {
    __input_stdin_array = __input_stdin.split("\n");
    var input;
    var input = parseInt(__input_stdin_array[__input_currentline].trim(), 10);
    __input_currentline += 1;


    res = fibonacciSequence(input);
    for(var res_i = 0; res_i < res.length; res_i++) {
        wstream.write(res[res_i]+"\n");
    }

    wstream.end();
});




2.Try-it-out - DOM - User Registration Details
Welcome to To read the user registration details

File Name - index.js

function myFunction() {
 var name = document.getElementById("myname").value;
 var phone = document.getElementById("myphone").value;
 var country = document.getElementById("mycontry").value;
 var email = document.getElementById("mymail").value;
 var result = name + "," + phone + "," + country + "," + email;
 alert(result);
 return result;
}




3.Try-it-out - DOM - Create Drop Down Country Field
Welcome to To create a drop down Country field

File Name - index.js

function runList(){
   var select = document.getElementById("list");
   var newOption = document.createElement("option");

   newOption.text = document.getElementById("txtbox").value;
   select.add(newOption);
}




4.Try-it-out - Generate random characters
Welcome to To generate Random Character id

File Name - index.js

function stringGen()
{
   var text = "";
   var val = document.querySelector("#num").value;
   var possible = "ABCDEFGHIKLMNOPQRSTVXYZabcdefghijklmnopqrstuvwxyz01234546789"
   for (var i=0;i< val; i++)
   text += possible.charAt(Math.floor(Math.random() * possible.length));
   return text;
}




5.Try-it-out - Simple Calculator
Welcome to To create a simple calculator

File Name - index.js

function update(value) {
    //Type the code here.
    document.getElementById('screen').value += value;
}

function result() {
    //Type the code here.
    document.getElementById('screen').value = eval(document.getElementById('screen').value);
}

function form_reset() {
    //Type the code here.
   document.getElementById('screen').value = "";
}




Post a Comment

Any comments and suggestion will be appreciated.
Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.

Join Telegram Channel

Join Notes Bureau Lets Teach and Learn

Join Telegram Channel
CLOSE ADS
CLOSE ADS