Strings: Properties, Methods & Template Literals in JavaScript | JavaScript Tutorial In Hindi #6
Vložit
- čas přidán 7. 09. 2024
- I have an updated version of JavaScript course going on. This Ultimate JavaScript course is being supplied with handwritten notes and I highly recommend the latest course over this.
Must watch the updated course here: • JavaScript Tutorials f...
►JavaScript Tutorial For Beginners In Hindi Playlist - • JavaScript Tutorials I...
►Source Code + Other Material - codewithharry....
This video is a part of my JavaScript In Hindi Course. JavaScript is a high-level, interpreted programming language that conforms to the ECMAScript specification. JavaScript has dynamic typing, prototype-based object-orientation, and first-class functions.
Alongside HTML and CSS, JavaScript is one of the best and most demanded technologies of the World Wide Web. JavaScript enables interactive web pages and is a crucial part of web applications. The vast majority of sites use it, and major web browsers have a dedicated JavaScript engine in order to execute it.
As a multi-paradigm language, it supports event-driven, functional, and imperative programming fashion. It has APIs for dealing with text, arrays, regular expressions, and the DOM, but the language itself does not include any I/O, such as networking, storage, or graphics facilities. It relies upon the host machine environment in which it is embedded to provide these features.
►Click here to subscribe - / @codewithharry
Best Hindi Videos For Learning Programming:
►Learn Python In One Video - • Learn Python In Hindi ...
►Learn JavaScript in One Video - • JavaScript Tutorial
►Learn PHP In One Video - • Learn Php In One Video...
►Machine Learning Using Python - • Machine Learning Tutor...
►Creating & Hosting A Website (Tech Blog) Using Python - • [Hindi] Web Developmen...
►Advanced Python Tutorials - • Intermediate/Advanced ...
►Object Oriented Programming In Python - • Object Oriented Progra...
►Python Data Science and Big Data Tutorials - • Python Data Science an...
Follow Me On Social Media
►Website (created using Flask) - www.codewithha...
►Facebook - / codewithharry
►Instagram - / codewithharry
►Personal Facebook A/c - / geekyharis
Twitter - / haris_is_here
I have an updated version of JavaScript course going on. This Ultimate JavaScript course is being supplied with handwritten notes and I highly recommend the latest course over this.
Must watch the updated course here: czcams.com/play/PLu0W_9lII9ahR1blWXxgSlL4y9iQBnLpR.html
Better than certification courses... and that too for free. Thanx alot Harry sir🙃
First time i see a girl is interested in coding 😅
🔥
@@exploreanything20yearsago95 yes 😅
@Explore Anything• 20 years ago programming language is designed by a lady thats why its too complicated😅😜😜
Very true, thank you sir
concat
length 5:17
tolowercase 5:23
touppercase 6:01
indexof 7:42
lastindexof 9:03
charAt 9:22
endswith 9:53
includes 11
//Template
let str1='JAVASCRIPT';
let str2='JS TUTORIAL';
let sem=` i learn ${str1} from CODE WITH HARRY ${str2} `
document.body.innerHTML=sem;
Bro , Did it run ?
@@rabinarayanbasantia8 mera to nahi ho raha hai
@@soumendramohanty7613 i learn JAVASCRIPT from CODE WITH HARRY JS TUTORIAL dekh mera toh aagay
@@soumendramohanty7613 yaar bhai mere bhi RUN nahi ho rha hai ...
@@educationiq5109 Mera tu hogya
let coder = 'Harry bhai'
let message1 = `You are doing a great job to teach us and inspire us by doing these videos.`
let message2 = 'We are so motivated by your videos and keep going.'
let myhtml = ` Hello ${coder}
${message1}${message2}
`;
document.body.innerHTML = myhtml;
Way better than any paid courses... and that too for free. Thanks Harry !!!!!
God Bless :)
// String Template
let para1 ="Good";
let para2 = "Nice";
let sentence = `${para1} Morning
${para2} to meet you!`
console.log(sentence);
// Good Morning
// Nice to meet you!
//Nice
Console.log(para2);
``
20:24
question done sir....
ans :
let car1 = 'BMW';
let car2 = 'Audi';
let lanHtml = ` I like ${car1} but my favourite car is ${car2}`;
document.body.innerHTML = lanHtml;
Output === " I like BMW but my fvourite car is Audi
Thanks sir great video!!!
you should use it in or
@@bhanu3045 yes @Krish Chaudhary we may use html also in template literels , all the HTML tags in ` `.
@@nirajkumarpatel6173 yea but we'll use only one tag, rather it's p tag or h tag. Right?
@@bhanu3045 no we can use any html tag in side the template literals and design our DOM (website).
@@nirajkumarpatel6173 can u explain me why lanhtml used here...
What is the use of document.body.innerhtml here
//Template Literal
let name = 'Virat';
let record = 'Centuries';
let record2 = 'runs';
let stats = `${name} will break most ${record} and ${record2} records of sachin`;
document.body.innerHTML = stats;
Nice bro
Question's ans
Let e1 = 'awesome'
Let theHtml = ` this is my heading
i am ${e1}`;
document.body.innerHtml=theHtml;
Thank you Harry sir for this awesome video
You haven't completed your .... tag.. so for curiosity I copied and tried to run on my vscode..
And it's not working..
I tried to figure out but I failed ..
Plezz recheck your code and tell me what's wrong in it
@@satyamrajchaudhary272 i forgot to mention here typing mistake
Please reply me ye first time Sikh rha muje ye template literals smj nhi aa rha kya aap apni Instagram id send kr skte h please 🙏
let code1= "javaScript tut";
let code2= "code with harry";
let ihtml= ` You are awesome teacher
I Really Enjoy ${code1} with "${code2}" `;
document.body.innerhtml =ihtml;
console.log(ihtml);
For Future Reference :
Let harry = "This is tutorial six";
harry.length
harry.toLowerCase
harry.toUpperCase
harry.indexOf("ry")
harry.lastIndexOf("r")
harry.charAt(1)
harry.endsWith("ry")
harry.includes("arr")
harry.substring(0,3)
harry.slice(0,4)
harry.split(" ")
harry.replace("h", "m")
15:55 - template literals
u are very genious person apk tutorial ki vjh sai hum bhut kuch sikh paa rhe hai thanks alot sir
let lan1 = `CSS`;
let lan2 = `JS`;
let name1 = `Everyone`;
let author = `Harry Bhai`;
let langs = `Hello ${name1},
This is an example.
I like ${lan1} but trying to get the knowledge of ${lan2}.
Thank You ${author} for the playlist. `;
document.body.innerHTML = langs;
Output:
Hello Everyone,
This is an example.
I like CSS but trying to get the knowledge of JS.
Thank You Harry Bhai for the playlist.
Your teaching method is so Unique, Clean and Clear Explanation with detailed knowledge... It help Us More in Learning Javascript. Thank you for making this Good Javascript Tutorial Series.
Bruh you have both the short-cut methods and the in-depth understanding I wonder how you got all that. Anyways hope you doing fine in this period. Respect +
Awesome content ... please keep making videos .. Loving your javascript course
// template
Let teacher = "harry";
Let topic = "Javascript tutorial";
Let topic2 = "Python";
Let class = ` ${teacher } is the best teacher ${teacher } taught us many languages such as : ${topic } , ${topic2}`;
Document.body.innerhtml = class;
Harry bhai just finished JavaScript Playlist, each topic very clearly explained . Awesome work bhai . Just a small request can you create playlist on Node.js .
I love this course i joined... And im new student.
let feedBack1 = course;
let feedBack2 = outstanding;
let feedBack = ` Your ${feedBack1} is, ${feedBack2}...`;
document.body.innerHTML = $feedBack;
Your course is outstanding...
Use this for css for now -
body{
background: linear-gradient(95deg, purple, rgb(209, 34, 34));
font-family: system-ui;
font-size: 25px;
}
this is awsome
Let str1= "coder";
Let str2= " js";
Let myHtml =` hello ${str1}
this is ha tutorials
, thankyou $(str1) for teaching us $(str2)
`;
document.body.innerHtml= myHtml;
harry bhai yaar maza aa gaya literally i went through dozens of js courses none of which suited my learning style but finally i found your course and it made my life alot easier thanks alot bhai : )
let name = ' happy ';
let fruit1 = ' apple ';
let fruit2 = ' banana ';
let htmlcode = `Hello, ${name}
Heloo falloas
I love to eat${fruit1}and${fruit2}
`;
document.body.innerHTML = htmlcode;
let name1 = 'Harry';
let cd = 'Java Script';
let myPro =
` Hello ${name1}, How are you?
Thanks for the amazing ${cd} tutorials. Very Helpful `;
document.body.innerHTML = myPro;
console.log(myPro);
Please reply me ye first time Sikh rha muje ye template literals smj nhi aa rha kya aap apni Instagram id send kr skte h please 🙏
let name = "sawan";
let marks = 65;
myhtml = `Hello ${name}
You have secured ${marks} marks
Congratulations
`;
document.body.innerHTML = myhtml;
const name=('Good Morning')
const dame=('Neeraj')
let color = 'red\'s'
let color1 = 'yellow'
let myname =`HELLO ji ${dame}
This is 'the' Heading
you like ${color} and ${color1}`
document.body.innerHTML = myname;
20:27
let favSport = "cricket"
let favSport2 = "Kabaddi"
let myHtml = ` Sports
your favSport is ${favSport} , ${favSport2}
`;
document.body.innerHTML = myHtml;
quetion done
Better than certification courses, thank you so much Harry sir.
let fruit1 = 'Orange';
let fruit2 = 'apple';
let html = `this is heading
you like ${fruit1} and ${fruit2}
`;
document.body.innerHTML = html;
Let fact = ' thanku so much sir !! '
Let mycode =` what a nice explanation sir ..${fact }` ;
document.body.innerHTML = mycode;
Output ---- what a nice explanation sir ..thanku so much sir !!
Please reply me ye first time Sikh rha muje ye template literals smj nhi aa rha kya aap apni Instagram id send kr skte h please 🙏
You are great human, sir.
let name = `by code with harry `;
let k = ` This is JavaScript ${ name.toUpperCase()}` ;
console.log(k);
let car1 = 'buggati';
let car2 = 'rolls royce';
let car3 = 'lamborghini';
let myHTML = `Luxurious cars are ${car1} and ${car2} and ${car3}`;
document.body.innerHTML = myHTML;
This video series is very very helpful Harry Bhai😎
ThankYou Sir I am A very Old Follower Of You And What Ever I Want to learn is available on your channel this just motivates me so much thankyou again for such awsome course for free
let name = "Omer"
let aim = "Goal is to finish JS at the end to march"
let start = "React JS"
let quizhtml = `hello I m ${name}
this is js learning class
${aim} and to start ${start}`
document.body.innerHTML = quizhtml;
Thank-you 👍
Template Literal is same as f-strings in python only the difference is here we are using ``
Ans)
name = "Ankesh";
code = `Hello ${name}`
document.body.innerHTML = code;
const htmlText = `I am writing HTML in javascript, watch this!!!
Hello, My Name is Kishan
Writing html test inside javascript and this is a paragraph.`;
document.body.innerHTML = htmlText;
*THANK YOU HARRY BRO FOR THIS TUTORIAL*
Love from Bangalore, India.
simply awesome better than any online paid course.
let car1 = 'bmw' ;
let car2 = 'nano';
let mycar= `Hello! ${name}
this is a BMW car
i hope you like ${car1}and ${car2}
`;
document.body.innerHTML = mycar;
Thank you sir for this playlist. Lots of love
Explanation is too easy to understand thankyou Harry Sir 🙌🏻
Just to add-> html.substring accepts (startindex and length of character) Not (startindex and endindex-1)
bhai jald bazzi mai galt bolgae at 13:36
console.log( html.substring(-4)) //likhne se puri string return karega
console.log(html.substring(1,8));// returns string from index 1 to index 8
console.log(html.slice(1,8));// returns string from index 1 to index 8
console.log(html.slice(-6));// return last 6 values of the string
commenting this for others to not get confused.
love u harry bhaai
20:24
let devices1 = 'SmartPhone';
let devices2 = 'PC/Laptop';
let myDevice = `Hello Everyone!
Name of two Devices are
${devices1} and ${devices2}`;
document.body.innerHTML = myDevice;
Please reply me ye first time Sikh rha muje ye template literals smj nhi aa rha kya aap apni Instagram id send kr skte h please sister 🙏
13:35 the substring does not accept negative value whereas slice accepts negative this is the main difference
what is the difference between substring and substr
@prasad tandel yes you are correct
@@nimisharaj8501 The difference between them is that substring() only accepts a positive values but substr() accepts both positive as well as negative values.
console.log('Welcome to Console');
let time = 'morning';
let user = prompt('Enter your name: ');
let prof = 'coding';
// prof = prof.toUpperCase();
let myHtml = ` Good ${time}, ${user.toUpperCase()}
Welcome to the world of ${prof.toUpperCase()}!
`;
document.body.innerHTML = myHtml;
let head='welcome in coding world';
let punch='AWSOME';
let para='This most beautifull thing is mind and most precious thing is time, ';
let html=`${head} ${para}if we connect both of them together the life will become ${punch}`;
document.body.innerHTML=html;
@CodeWithHarry pls next ajax and jquery
let pencil1 = 'oxfiit';
let pencil2 = 'natrajan';
let rHTML = ` i like ${pencil1} and but my fav. is ${pencil2}`;
document.body.innerHTML = rHTML;
output
i like oxfiit and but my fav. is natrajan
courses - better than UDEMY, thanku harry sir
Who was your teacher? Curious to know how you received such in-depth knowledge.🤔
Ayee hayee rashmi ji
me
IIT Kharagpur is his college
@@AKSHAR_31 Source ?
@@divyanshpal8625 😂
let x = " this is string"
let new = `javascript`${x}
This is the example of Templets method
document.write(new)
=>javascript this is string
This is the example of Templets method
let place1 = "Delhi";
let place2 = "mumbai";
let b = "Nimisha";
let myhtml = `hello ${b}
We have booked "your" fight
your destination is ${place1} and ${place2} `;
document.body.innerHTML = myhtml;
let str1 = "mohsin";
let str2 = "hassan";
let name = `my first name is ${str1} my last name is ${str2}`;
document.body.innerHTML =name;
your ways are just awesome, BORN TO BE A MENTOR!!
sid by side screen learning is best concept herry ji
let fruit1='gwava';
let fruit2='orange';
let itsHtml=`hello ${name1}
its some h1 tag
and its some fruits
${fruit1} and ${fruit2}
`
document.body.innerHTML=itsHtml;
const name="Anoushka";
let greeting="Good Morning";
let series1="Game of Thrones";
let series2="Money Heist";
let favSeries=` ${greeting} eveyone.
My name is ${name}.
My favourite series are ${series1} and ${series2}.`;
document.body.innerHTML=favSeries;
It is getting more interesting ❤
Ur a celebrity
Yeh harry bhai wala rohan das hain kya?
20:24
let myName="kundan";
let mylastName=" Patil";
let SchoolName="Sarswati vidya Mandir";
let Villege="Yawal";
document.write(`My Bio
Hello My name is ${myName}${mylastName} i went to teach in ${SchoolName}
and my villege is${Villege}`);
/*HomeWork Complete Sir */
let fruit1 = `apple`;
let fruit2 = `mango`;
let newhtml = ` Hello ${name}
How are you
This is the new heading
i like ${fruit1} and ${fruit2}.
`
document.body.innerHTML = newhtml;
let str1='Abdullah';
let str2='Fullstack';
let ans =` ${str1} do you want to learn ${str2} from code with harry??
Ans :- Yes then you can do it...
`;
document.body.innerHTML= ans;
console.log("STRINGS");
const namee = "PIYU$H";
const greeting = "GOOD MORNING ";
const total = ` ${greeting}` + `${namee} `;
console.log(total);
document.body.innerHTML = total;
Awesome course and better understanding. Thank you Harry Sir...
From Bangladesh.
let name="Kunal";
let greeting = "Good Morning"
let lang = "Javascript";
let endmsg = "Thank You"
let strtemp = `Hello ${name}
${ greeting }
This is written in ${ lang } language
${ endmsg } `;
document.body.innerHTML=strtemp
console.log(strtemp)
let name = 'Sahil';
let like = 'Web Development';
let tech = 'Front-end';
let time = 'By the end of this year';
let goal = ` ${name} is learning ${like}
and he would learn ${tech} ${time}.`;
document.body.innerHTML = goal;
const name1= 'BMW';
const name2= 'AUDI';
const myHtml= `hello ${name}
this is my heading
i like ${name1} and ${name2}`;
document.body.innerHTML= myHtml;
// TODO: exerciselet
fullName = "Pradeep yadav";let fav_Language = "JavaScript";let my_Info = `My name is ${fullName} My favorite programming language is ${fav_Language}.`document.body.innerHTML = my_Info;
let colur = 'blue';
let colur1 = 'red';
let mycolur = `This is my favorite color there are many colors in the world but two colors most use as:${colur} and no two is ${colur1}`;
document.body.innerHTML=mycolur;
For some reason I had to put block {} around it to work.. I hadn't used myHtml anywhere before in document
Here is what worked:
{
let name = "Krushna";
let greeting ="Good evening";
let myHtml = `Hello ${name} + ' ' + ${greeting}
`;
document.body.innerHtml=myHtml;
}
Output: Hello Krushna Good evening
let name='Prinsh'
const color1='pink'
const color='blue'
const color2='yellow'
let b=`Hay ${name} wcich color do you like most ${color} or ${color1} or ${color2} pick your faverit color now `
document.write(b)
Explanation is easy to understand !
Thankyou so much Harry for JS Tutorial !
Very nice explanation harry bhai.....Awesome!!!
This tutorial is very useful.
Let name ='Aniket';
Let greet='wishes';
Let wish ='Happy Teacher's Day';
Let myhtm='Good Morning Sir $(name) $(greet) a very $(wish)
document.body.innerHtml=myhtm;
Ans for quiz:
Ans:
let name= 'Harry sir';
let country1= 'Bangladesh'
let phone1= 'Asus_ROG\5';
let phone2= 'Xiaomi';
let finisherHTML= `Hello ${name}
Phone Fantasy
My favourite phone model is ${phone1} but i use ${phone2}. i will buy ${phone1} when its available in ${country1}.`;
document.body.innerHTML= finisherHTML;
let cars = ['Audi ','BMW ','honda '];
let name = " Sumith Singh ";
let html2=(`Hey Everyone , This is ${name} , i have ${cars}in my garage`)
;
document.body.innerHTML=(html2)
let name=`Sourya`;
const sub=`Web Development`;
let arr=[`HTML`,`CSS`,`JS`];
let line=`My name is ${name} and i love ${sub} especially ${arr} along with other JS Frameworks.`;
console.log(line);
OUTPUT :- My name is Sourya and i love Web Development especially HTML,CSS,JS along with other JS Frameworks.
let him = 'Harry Sir';
let nature = 'awesome';
let description = ` ${him} is ${nature}`;
document.body.innerHTML = description;
let name = "Yubi";
let html = `Hello ${name}
This is Headind
This is paragraph and only for you ${name}
`;
console.log(html);
console.log("We are at tut 6");
let fruits = ['Orange', ' Apple', ' Mango']
let myHtml = `Hello ${name}
You like ${fruits}
This is a para`;
alert("chal rhi hai na");
let myname = "aman";
let sport = "cricket";
let html=`MY NAME IS ${myname}
i love to play ${sport}`;
document.body.innerHTML=html;
lenght concat indexof lastindexof charat lowercase uppercase substring slice includes split replace
let sub1="Maths";
let sub2="Science";
let class=`This is my favorite subjects ${sub1} and ${sub2} `;
document.body.innerHTML=class;
20:24 Quiz
let bike1 = 'KTM';
let bike2 = 'Kawasaki';
let rep = `Hello my name is ${name1}
This is "my" heading
I love ${bike1} and ${bike2} `;
document.body.innerHTML = rep;
// Here is a answer
let name = "NIK";
let class1 = "Kinder Garden";
let intrest = "Learning Web Devlopment With 'Harry bhai' ";
let greeting = `
My Introduction
NAME-- ${name}
CLASS-- ${class1}
INTREST-- ${intrest}`;
document.body.innerHTML = greeting;
console.log(greeting);
let game1 = 'GTA V';
let game2 = 'Runescape';
let game3 = 'League of Legends'
let myFavGame = `Hello ${name}.
What is your favorite game?
My favorite game is ${game2} but I also like ${game1} and ${game3}!
`;
document.body.innerHTML = myFavGame;
Sir if I use to learn the code with live server, except google crome Microsoft edge is getting open . Please help in converting to google crome
Great explanation of string methods and template literals ...
let course='javascipt';
let teacher='harry bhai'
let thisHtml=`hello i am learning ${course}
from the one and only
${teacher}
`;
document.body.innerHTML=thisHtml;
Output:
hello I am learning Java Script from the one and only
Harry bhai
Thanks u bhaiya and quiz :
// Quiz time
let name ="Himanshu";
let car1='Lamborgini gallardo';
let car2='Rolls Royce';
let car3='Range Rover';
let car4='Mercedes ';
let mycars=` Hello Buddy there are some new cars in MY Garrage
${car1}
${car2}
${car3}
${car4}
Total Amount : 36 CR
`
document.body.innerHTML=mycars;
Output: Hello Buddy there are some new cars in MY Garrage
Bullet Lamborgini gallardo
Bullet Rolls Royce
Bullet Range Rover
Bullet Mercedes
Total Amount : 36 CR
let state ="haryana";
let mystate = `haryanvi is language is ${state};`
document.body.innerHTML = mystate
"haryanvi is language is haryana;"
let city= "tumkur ";
let state= "karnataka";
let myLocation= ` i am from ${city} and ${state} very intresting tutorial `;
document.body.innerhtml= myLocation;
awesome harry bhai . keep uploading
let food1=`Masala Dosa`;
let food2=`Chutney`;
let myHtml=`Welcome`${name}
YOU LIKE ${food1} and ${food2};
document.body.innerHTML=myHtml;
challenge accepted
let name = `User`;
let car1 = 'Buggati';
let car2 = 'Lamborgini';
let output = `Welcome to this server
Hello ${name}
I love ${car1}
But my fav. car is ${car2}
Thank you`;
document.body.innerHTML = output;
let lan1 = 'javascript';
let lan2 = 'paython';
let myFav =`Hello my Name is ${name}
This is my first JS
I like ${lan1} and ${lan2}
`;
document.body.innerHTML = myFav ;
Thanks For Sharing!
Thanks!
ans.
let myfav = 'Scorpio';
let mylov = 'Fortuner';
let html1 = ` My favourite is ${myfav} but i love ${mylov}.`;
document.body.innerHTML=html1;