---
title: "Comment by Purvi Barot on \"The difference between String and string in Typescript\" | Hashnode"
description: "Here is an example that shows the differences: var s1 = new String ( &quot;Avoid newing things where possible&quot; ); var s2 = &quot;A string, in TypeScript of"
url: "https://hashnode.com/posts/the-difference-between-string-and-string-in-typescript/6022db0c3f7a783c6be412a3/comment/6026063ac6d91052dafe93ec"
---

[Discussion](https://hashnode.com/posts/the-difference-between-string-and-string-in-typescript/6022db0c3f7a783c6be412a3)

Comment [The difference between String and string in Typescript](https://hashnode.com/posts/the-difference-between-string-and-string-in-typescript/6022db0c3f7a783c6be412a3)

[Purvi Barot](https://hashnode.com/@purvi)

[Feb 12, 2021](https://hashnode.com/posts/the-difference-between-string-and-string-in-typescript/6022db0c3f7a783c6be412a3/comment/6026063ac6d91052dafe93ec)

Here is an example that shows the differences:

```
var s1 = new String("Avoid newing things where possible");
var s2 = "A string, in TypeScript of type 'string'";
var s3: string;
```

**String** is the JavaScript String type, which you could use to create new strings. Nobody does this as in JavaScript the literals are considered better, so s2 in the example above creates a new string without the use of the new keyword and without explicitly using the String object.

**string** is the TypeScript string type, which you can use to type variables, parameters and return values.

[Josias Aurel](https://hashnode.com/@JosiasAurel)

[Feb 12, 2021](https://hashnode.com/posts/the-difference-between-string-and-string-in-typescript/6022db0c3f7a783c6be412a3/comment/6026063ac6d91052dafe93ec#reply-602612a3c6d91052dafe94ac)

Nice.
