This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// starts and ends with a single quote | |
var myUserName = 'suhail03'; // albhabets + numbers | |
// starts and ends with a double quote | |
var myFullName = "suhail gupta" | |
// starts and ends with a backtick | |
var myTwitterUserName = `suhailg03`; | |
console.log(myUserName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The following is an incorrect way | |
// to represent multiple single quotes | |
// in a string which already starts with a | |
// single quote | |
// var singleQuoteString = 'suhail 'gupta''; | |
// console.log(singleQuoteString); | |
var myNewVariable = "suhail 'gupta'"; | |
console.log(myNewVariable); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var string1 = "mahima"; | |
var string2 = "bhat"; | |
// can concatenate (join) 2 or multiple strings | |
// using + operator | |
var fullName = string1 + " " + string2 | |
// string1 gets added to an empty string (which is a space here) | |
// which then gets added to string2 | |
// mahima + " " + bhat | |
console.log(fullName); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var firstName = "Aditya Gupta"; | |
var lastName = "Gupta"; | |
var x = firstName + " " + lastName + " is a student with alma better"; | |
console.log(x); | |
var fullName = `${firstName} ${lastName} is a student with alma better`; | |
console.log(fullName); | |
var news = `Karnataka Election Result 2023 LIVE | Shivakumar Says |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var oneWay = {} | |
var anotherWay = new Object(); | |
// Both of them above create an object (empty object) | |
oneWay.city = "bangalore"; | |
anotherWay.city = "mysore"; | |
console.log(oneWay) | |
console.log(anotherWay); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var person = { | |
name: 'manoj', | |
age: 20, | |
employee: { | |
id: 200, | |
role: 'software engineer', | |
duration: 2, | |
salary: { | |
rupees: 123456, | |
recentlyChanged: false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const response = { | |
mode: 'none' | |
}; // Objects are Javascript specific!!!!!!! | |
// Use strings to send data in the network!!! | |
console.log(response); | |
// WE WILL NEED TO CONVERT OBJECT INTO STRING | |
var myNewString = JSON.stringify(response); | |
console.log(myNewString); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function greet() { | |
console.log("Good evening, friends!"); | |
console.log("One more statement before the fn exits"); | |
} | |
// greet is the name of the function [entity] | |
greet(); // calling the function named greet | |
// () are mandatory to call a function | |
console.log("After the function call"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("hello"); | |
console.log("hello 2"); | |
console.log("hello 3"); | |
var z = 100 | |
function greet() { | |
console.log("Good evening, friends!"); | |
console.log("Good morning, friends!"); | |
} // Here the fn will EXIT, which means | |
// that it has carried out its job |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function greet(message, nameOfThePerson) { | |
var greetMessage = `Hello, ${nameOfThePerson}! ${message}`; | |
console.log(greetMessage); | |
} | |
greet("Good evening", "Mahima"); | |
greet("Good morning", "Adity"); | |
greet("Arjun", "Good evening"); |