DEV Community

Shivam Sahu
Shivam Sahu

Posted on • Updated on

td script

script 1 - How To Parse And Stringify JSON Data Using Angular

Hi Guys welcome back to target developers
my name is shivam sahu
I am Experienced angular frontend developer.
we have IT software projects available in below technologies-
If you need IT Software project whatsapp me 9752245608.
And also you can hire me for project freelance.

so guys in this part of video we will see -

In angular 17 how we can send simple object in the form of JSON format from frontend side to backend side.

Firstly we need to understand that how we can made simple object in
typescript so guys we will open typescript file and make myData object
with open and close curly braces under this we defined name qualification
technology so in this way we can create simple object.

So now we will convert myData object into json format. here you can see for this
inside ngoninit function we are using json.stringify method.
under this method we are passing mydata object which were created earlier.

and also you can see we are taking holding variable named as stringifieddata . Now we will console the result you can see on the screen.
you can observe here name has double quoted and manav also double quoted.
so we have successfully converted object to json object.


Now guys if there is a case where we have json object and we need to convert to simple object then what we will do ?
so in this case we will use JSON.parse("json object").
now lets see how we can achieve this -

you observe here stringifiedata variable holding json object so we will write json.parse function passing stringifiedata (json object).

now we will console the output. Yo can see on the screen we have succssfully converted json obect to simple object.

I this part of video we will see the during development of angular project sometimes we try to print object in html file but we observe that object is printing in the form of [object object] you can see on the screen.
so how we can unwrap this in html template so here we will use new angular concept that is json pipe.
so now lets see how we can achieve this ?

open typescript file you can see we have simpleobject named as myData now this myData try to print in html template so we will use pre tag here under this we use interpolation and type myData | json (json pipe).
note- for using json pipeyou need to import common module.

we have successfully unwrap [object object] using json pipe you can see output on the screen.

script 2 - Javascript string manipualtion interview questions.

Hi guys, Welcome back to Target Developers, I'm shivam sahu, and today we have an exciting video planned just for you

So, In today's video, we're going to explore Javascript string manipualtion interview question.

We're covering here coding interview questions and also you can download source code and word document from the
video description, so stay tuned

Before we dive in, make sure to subscribe and hit that bell icon so you never miss an update. If you enjoy this video, give it a thumbs up and share it with your friends

----start---
so guys firstly we will call function from this line named as reverseString, inside this function we are passing string value, which we want to reverse, here we can see we are passing my name shivam sahu.

Now guys we will create function, which we are trying to call,
inside this function we are taking variable which will hold string value i.e. shivam sahu
In next line we are declaring varibale named as reversedStr with empty string.

in next two lines you can see we are calculating string legth,
we can see we are getting legth 10 of given string. But we all know
that guys array start with index 0 so here we are iterating for loop from
length-1 and here we are giving condition i >=0 .

so in next line one by one we are getting character from end of string and the we are adding with empty string i.e. reversedStr.

so for loop will iterate until its fails and when it fails function will
return reversed string.

we are holding output in variable i.e. reversedString .

now we will console so you can see we have successfully reversed our given string.

Top comments (0)