Practice
Resources
Contests
Online IDE
New
Free Mock
Events New Scaler
Practice
Improve your coding skills with our resources
Contests
Compete in popular contests with top coders
logo
Events
Attend free live masterclass hosted by top tech professionals
New
Scaler
Explore Offerings by SCALER

Input and Output

What is Javacript?

JavaScript (JS) is a lightweight, interpreted, or just-in-time compiled programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js, Apache CouchDB and Adobe Acrobat. JavaScript is a prototype-based, multi-paradigm, single-threaded, dynamic language, supporting object-oriented, imperative, and declarative (e.g. functional programming) styles.

JavaScript is primarily known as the language of most modern web browsers.

 


Features of JavaScript

  • All popular web browsers support JavaScript as they provide built-in execution environments.
  • JavaScript follows the syntax and structure of the C programming language. Thus, it is a structured programming language.
  • JavaScript ignores spaces, tabs, and newlines that appear in JavaScript programs.
  • JavaScript is a weakly typed language, where certain types are implicitly cast (depending on the operation).
  • JavaScript is an object-oriented programming language that uses prototypes rather than using classes for inheritance.
  • It is a light-weighted and interpreted language.
  • It is a case-sensitive language.
  • JavaScript is supportable in several operating systems.
  • It provides good control to the users over the web browsers.

 

Variables :

Variables allow computers to store and manipulate data in a dynamic fashion. They do this by using a “label” to point to the data rather than using the data itself. Any of the eight data types may be stored in a variable.

Variables are similar to the x and y variables you use in mathematics, which means they’re a simple name to represent the data we want to refer to. Computer variables differ from mathematical variables in that they can store different values at different times.

To define a variable in JavaScript, you use var keyword. For example:
var x = 10;
var y = 20;

 

 

Taking Input from user:

To take an input string from console and saving it to a variable, we can write:

var a = readLine()

Now, variable a holds a string which is given as input in the console.

 

 

Output “Hello, world!”

To output/print string “Hello, word!” on the console, we can write:

console.log("Hello, world!")

 

 

Try the following example in the editor below.

Take a user input string and print space separated “Hello” and input (without quotes).

 

Input

Read a string input.

 

Output Format

Print Hello input to stdout.

 

Example Input

InterviewBit

Example Output

Hello InterviewBit
Start solving Input and Output on Interview Code Editor
Hints
  • Hints are not available for this problem

Discussion


Loading...
Click here to start solving coding interview questions
Free Mock Assessment
Fill up the details for personalised experience.
Phone Number *
OTP will be sent to this number for verification
+1 *
+1
Change Number
Graduation Year *
Graduation Year *
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
*Enter the expected year of graduation if you're student
Current Employer
Company Name
College you graduated from
College/University Name
Job Title
Job Title
Engineering Leadership
Software Development Engineer (Backend)
Software Development Engineer (Frontend)
Software Development Engineer (Full Stack)
Data Scientist
Android Engineer
iOS Engineer
Devops Engineer
Support Engineer
Research Engineer
Engineering Intern
QA Engineer
Co-founder
SDET
Product Manager
Product Designer
Backend Architect
Program Manager
Release Engineer
Security Leadership
Database Administrator
Data Analyst
Data Engineer
Non Coder
Other
Please verify your phone number
Edit
Resend OTP
By clicking on Start Test, I agree to be contacted by Scaler in the future.
Already have an account? Log in
Free Mock Assessment
Instructions from Interviewbit
Start Test