10 days of javascript with HackerRank
From today i am trying to discuss about 10 days of Javascript challenge on HackerRank which is strong about our basic of Javascript.This series focuses on learning and practicing JavaScript.Site of HackerRank :https://www.hackerrank.com/domains/tutorials/10-days-of-javascript
Day-0: hello world:
Task:A greeting function is provided for you in the editor below. It has one parameter, parameterVariable . Perform the following tasks to complete this challenge:
- Use
console.log()
to printHello, World!
on a new line in the console, which is also known as stdout or standard output. The code for this portion of the task is already provided in the editor. - Use
console.log()
to print the contents of parameterVariable (i.e., the argument passed to main).
You’ve got this!!!
Solution: here greeting function is editor function you should write your code on this function
function greeting(parameterVariable) {console.log(‘Hello, World!’);//here you can also use double qoute.. console.log(parameterVariable);}
Day 0 : Data Types :
Task :
Variables named firstInteger,firstDecimal, and firststring are declared for you in the editor below. You must use the operator to perform the following sequence of operations:
- Convert secondInteger to an integer (Number type), then sum it with firstInteger and print the result on a new line using
console.log
. - Convert secondDecimal to a floating-point number (Number type), then sum it with firstDecimal and print the result on a new line using
console.log
. - Print the concatenation of firstString and secondString on a new line using
console.log
. Note that firstString must be printed first.
Solution :
function performOperation(secondInteger, secondDecimal, secondString) {const firstInteger = 4+Number(secondInteger);const firstDecimal = 4.0+Number(secondDecimal);const firstString = ‘HackerRank ‘;console.log(firstInteger)console.log(firstDecimal)console.log(firstString.concat(secondString))}
Thanks everyone. Here is from my side today.
HAPPY CODING!!!!!