This file contains 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
array1 = [1, 2, 3, 5]; | |
object1 = { | |
key1: "value1", | |
key2: "value2", | |
}; | |
//Spread operator in array | |
array2 = [10, ...array1]; | |
console.log(array2); |
This file contains 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
let details = [11, 13, 17, "Prime Numbers"]; | |
//Looping through array | |
for (const detail of details) { | |
console.log(detail); | |
} |
This file contains 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 financialInfo = { | |
City: "New York", | |
Artform: "Jazz", | |
Artist: "Miles Davis", | |
TicketCurrency: "$", | |
Cost: 200, | |
}; | |
//Destructuring Object | |
const { Artist, TicketCurrency, Cost } = financialInfo; |
This file contains 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 Currency1 = "Dollars"; | |
const Currency2 = "Rupees"; | |
const exchange_rate = 72; | |
news_string = "Today 100 " + Currency1 + " are trading for " + exchange_rate * 100 + " " + Currency2; | |
//The normal way | |
console.log(news_string); | |
//The template literal way | |
news_string_tl = `Today 100 ${Currency1} are trading for ${exchange_rate * 100} ${Currency2}`; |
This file contains 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
import re | |
test_email_1 = "Jane.doe1971@gmail.com" | |
test_email_2 = "JD@msn.org.edu" | |
test_email_3 = "J.A.N.E@web123.AI" | |
test_emails = [test_email_1, test_email_2, test_email_3] | |
def extract_info(email_string): | |
# Search for username | |
# Methodology | |
# All alphabets and numbers before @ |
This file contains 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 constExample() { | |
const k = 1; | |
k = 2; | |
} | |
function go() { | |
constExample(); | |
} |
This file contains 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
// Let scope function | |
function letExample() { | |
for (let i = 0; i < 10; i++) { | |
console.log("i = ", i); | |
} | |
console.log("i outside of scope = ", i); | |
} | |
function go() { | |
letExample(); |
This file contains 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 scope function | |
function varExample() { | |
for (var i = 0; i < 10; i++) { | |
console.log("i = ", i); | |
} | |
//console.log("i outside of scope = ", i); | |
} | |
function go() { | |
varExample(); |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Document</title> | |
</head> | |
<body> | |
<h1>Javascript Var v/s Let v/s Code</h1> | |
<script src="index.js"></script> |
This file contains 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
dummy_data_1 <- tribble( | |
~Country, ~"Time", ~"Score", ~"Gender", | |
"INDIA", "AM", 20, "male", | |
"INDIA", "PM", 20, "female", | |
"INDIA", "AM", 50, "male", | |
"INDIA", "PM", 40, "male", | |
"INDIA", "AM", 20, "female", | |
"USA", "AM", 30, "male", | |
"USA", "PM", 30, "male", | |
"USA", "PM", 30, "female", |