Question

Have to use JaveScript and the code provided under the problem. It has to be solved...

Have to use JaveScript and the code provided under the problem. It has to be solved with those guidelines provided on the website on the right side of the screen JavaScript only

https://www.hackerrank.com/challenges/js10-data-types/problem

0 0
Add a comment Improve this question Transcribed image text
Answer #1

The answer to this question is as follows:

The code is as follows:

'use strict';

process.stdin.resume();

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

let inputString = '';

let currentLine = 0;

process.stdin.on('data', inputStdin => {

    inputString += inputStdin;

});

process.stdin.on('end', _ => {

    inputString = inputString.trim().split('\n').map(string => {

        return string.trim();

    });

    

    main();    

});

function readLine() {

    return inputString[currentLine++];

}

function performOperation(secondInteger, secondDecimal, secondString) {

    const firstInteger = 4;

    

    const firstDecimal = 4.0;

    

    const firstString = 'HackerRank ';

    

    console.log(firstInteger+parseInt(secondInteger));

    

    

    console.log(firstDecimal+parseFloat(secondDecimal));

    

    

    console.log(firstString+secondString);

    

}


The input and output are provided in the screenshot below:

Add a comment
Know the answer?
Add Answer to:
Have to use JaveScript and the code provided under the problem. It has to be solved...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Python Programming language. Complete the problems below using Jupyter Notebook. Problem Needs to be solved from...

    Python Programming language. Complete the problems below using Jupyter Notebook. Problem Needs to be solved from number #1 link provided for the Data: -----> https://docs.google.com/spreadsheets/d/1TqhyxFKQlOHAyXpQBL-4C96kgZFBoMwUgE8-b33CqPQ/edit?usp=sharing PROBLEMS # 0.0 Import the libraries (pandas, matplotlib, and seaborn) Include the code line: %matplotlib inline #Include the code line: plt.style.use(“ggplot”) #Load the data using pandas #Inspect the data using head(), dtypes ANSWERD: import pandas as pd import matplotlib.pyplot as plt import seaborn as sns plt.style.use('ggplot') %matplotlib inline df = pd.read_csv() print(df.head()) print(df.dtypes) # 1...

  • abe 2 Use the provided HTML for the following questions. You only need to write the...

    abe 2 Use the provided HTML for the following questions. You only need to write the JavaScript code for the following questions. No need to write a full JavaScript application. Ex. if I said "Set a myVar variable equal to 2" you would simply write myVar = 2; Please write your code in a separate file. The file MUST be named with the following format lastname_firstname.js. Use comments to divide the questions on the single JavaScript file. Example, for question...

  • Evaluate using MATLAB. The problem has been solved arithmatically but MATLAB code is needed. Use Matlab...

    Evaluate using MATLAB. The problem has been solved arithmatically but MATLAB code is needed. Use Matlab to evaluate: A tube with length of 1 m is made from steel (k 15 W/m/K) having a square cross section with a circular hole through the center, as shown below Calculate the steady state temperature distribution across the cross section and the total rate of heat transfer if the inner surface is held at 20 °C, and the outer surface is held at...

  • List of Equations (Use only if the problem must be solved in terms of vectors) 3)...

    List of Equations (Use only if the problem must be solved in terms of vectors) 3) d,-Xy-x, or dy-y-yi (Do not use if #2 applies) 4) d - di + d2+" (Use only if the problem must be solved in terms of vectors) 7) ux dx/1t or vy-dy/1t (Do not use if #6 applies) (Do not use if #7 or #9 applies) 9) s-[Cycle Length]/[Cycle Time] 10) s- [Cycle Length] x [Cycle Rate] 13) α-(vf-Vi)/1t or a-Δυ/ΔΙ (Use only if...

  • Interpreting an LP output after solving the problem using the software.                The following linear programming problem has been solved using the software. Use the output to answer the questi...

    Interpreting an LP output after solving the problem using the software.                The following linear programming problem has been solved using the software. Use the output to answer the questions below. LINEAR PROGRAMMING PROBLEM: MAX 25X1+30X2+15X3 S.T.   1) 4X1+5X2+8X3<1200 2) 9X1+15X2+3X3<1500 OPTIMAL SOLUTION: Objective Function Value =         4700.000   Variable Value Reduced Costs X1 140.000 0.000 X2 0.000 10.000 X3 80.000 0.000 Constraint Slack/Surplus Dual Prices 1 0.000 1.000 2 0.000 2.333 OBJECTIVE COEFFICIENT RANGES: Variable Lower Limit Current Value Upper Limit...

  • how would i code this in MATLAB 4. The goal in this problem is to add...

    how would i code this in MATLAB 4. The goal in this problem is to add two 20 digit integers Sounds easy right? Try this: 1 11111111 1111; printf("%30.08 ) The issue is that the computer cannot store a 20 digit integer exactly. You need to find a ww around this but use non-standard data types (you can't just use a big float) Create a function whose input is two 20 digit integers. Return the sum of the integers. In...

  • Fake News This exercise is about modifying the content of a page in your web browser using Javascript. As we have said, Javascript has access to the current page via the Document Object Model or DOM....

    Fake News This exercise is about modifying the content of a page in your web browser using Javascript. As we have said, Javascript has access to the current page via the Document Object Model or DOM. In your browser, the variable document represents the current document and your code can use it to read and write to the current page. In this exercise we will use the developer tools Javascript console to write Javascript to access parts of the main...

  • I included problem one for reference. I only need problem two solved. Please use excel to...

    I included problem one for reference. I only need problem two solved. Please use excel to solve. The problem and the data provided must be clearly laid out in the spreadsheet and cell referencing must be used 1. A stock sells for $10 per share. You purchase 100 shares for $10 a share (i.e., for $1,000), and after a year the price rises to $17.50. What will be the percentage return on your investment if you bought the stock on...

  • The following linear programming problem has been solved by LINDO. Use the output to answer the...

    The following linear programming problem has been solved by LINDO. Use the output to answer the questions. (Scroll down to see all). LINEAR PROGRAMMING PROBLEM MAX 41X1+52X2+21X3 S.T. C.1) 5X1 + 5X2 + 9X3 < 1200 C.2) 11X1 + 14X2 + 5X3 < 1500 END LP OPTIMUM FOUND AT STEP      1         OBJECTIVE FUNCTION VALUE         1)      5795.049 VARIABLE        VALUE          REDUCED COST         X1 0.000 0.217822         X2         74.247 0.000000         X3 92.079 0.000000        ROW   SLACK OR SURPLUS     DUAL...

  • 4. We have the following data r 12 3 2 4.2 5. When you fitted a linear model to this data set, you solved a least squares problem. Your task here is to perform a SVD and then use it to solve the...

    4. We have the following data r 12 3 2 4.2 5. When you fitted a linear model to this data set, you solved a least squares problem. Your task here is to perform a SVD and then use it to solve the least squares problem. 4. We have the following data r 12 3 2 4.2 5. When you fitted a linear model to this data set, you solved a least squares problem. Your task here is to perform...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT