# Textwrap is not defined

**URL:** https://discourse.processing.org/t/textwrap-is-not-defined/31967
**Category:** Beginners
**Created:** [August 27, 2021, 12:30pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967 "2021-08-27T12:30:55Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Omri](https://avatars.discourse-cdn.com/v4/letter/o/bc79bd/32.png) [@Omri](https://discourse.processing.org/u/Omri)
#### Post date: [August 27, 2021, 12:30pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/1 "2021-08-27T12:30:55Z")

</div>

Hey,  
I’m trying to use the textWrap function but I got an error: “Uncaught (in promise) ReferenceError: textwrap is not defined”.

I suspect that the problem is maybe in the p5.min.js library, is that make sense? how can I check that?

here is the part with the libraries in my HTML:

```auto
<head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/addons/p5.dom.min.js"></script>
  <meta charset="utf-8" />
</head>

```

thanks 🙂

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [August 27, 2021, 12:44pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/2 "2021-08-27T12:44:17Z")

</div>

Hi @Omri,

Can you provide your code (or the specific part of it) where you try to use the `textWrap` function?

---

<div class="post-metadata">

### Author: ![Omri](https://avatars.discourse-cdn.com/v4/letter/o/bc79bd/32.png) [@Omri](https://discourse.processing.org/u/Omri)
#### Post date: [August 27, 2021, 1:52pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/3 "2021-08-27T13:52:35Z")

</div>

Hi @josephh, here it is:

```auto
    textwrap(CHAR);
    text("some text", 100, 100,200);
```

---

<div class="post-metadata">

### Author: ![Ariadne](https://avatars.discourse-cdn.com/v4/letter/a/71c47a/32.png) [@Ariadne](https://discourse.processing.org/u/Ariadne)
#### Post date: [August 27, 2021, 2:20pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/4 "2021-08-27T14:20:05Z")

</div>

I think that the error is because you used `textwrap` instead of `textWrap`. Variables in JavaScript (and most other languages) are case-sensitive, so `textwrap` and `textWrap` are two completely different bindings, independent of each other.

So, to make your code work, replace all occurences of `textwrap` to `textWrap`.

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [August 27, 2021, 2:23pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/5 "2021-08-27T14:23:20Z")

</div>

Thanks!

Most of the programming languages out there are case sensitive, meaning that any identifier with or without upper case letters is not the same.

It’s true for functions, therefore `textwrap` doesn’t exist!

When you have any questions on the API, check the reference:

[https://p5js.org/reference/](https://p5js.org/reference/)

Specially the `textWrap` function:

[https://p5js.org/reference/#/p5/textWrap](https://p5js.org/reference/#/p5/textWrap)

Also note that this is a common convention in JavaScript to put function names in [camelCase](https://en.wikipedia.org/wiki/Camel_case) 😉

---

<div class="post-metadata">

### Author: ![Omri](https://avatars.discourse-cdn.com/v4/letter/o/bc79bd/32.png) [@Omri](https://discourse.processing.org/u/Omri)
#### Post date: [August 27, 2021, 2:25pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/6 "2021-08-27T14:25:18Z")

</div>

Hi @Ariadne & @josephh , thanks for the answer.  
I wrote here by mistake `textwrap` and not `textWrap`…  
In my code its:

```auto
textWrap(CHAR);
text("some text", 100, 100,200)

```

and still I got the error:  
`Uncaught (in promise) ReferenceError: textWrap is not defined`  
sorry for the mistake

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [August 27, 2021, 2:47pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/7 "2021-08-27T14:47:28Z")

</div>

Ok my bad!

If you remove the call to `textWrap`, do other p5 functions work?

---

<div class="post-metadata">

### Author: ![Omri](https://avatars.discourse-cdn.com/v4/letter/o/bc79bd/32.png) [@Omri](https://discourse.processing.org/u/Omri)
#### Post date: [August 27, 2021, 2:58pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/8 "2021-08-27T14:58:25Z")

</div>

Yes, also I tried the `textWidth`, `textSize`, `textAlign`  
and they all works.

I looked at the `https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.9.0/p5.min.js`  
and I found there all of `textWidth` , `textSize` , `textAlign`, but didn’t find the `txetWrap`.  
So maybe its not the right library or something? 🤔

---

<div class="post-metadata">

### Author: ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)
#### Post date: [August 27, 2021, 3:18pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/9 "2021-08-27T15:18:40Z")

</div>

All right, it’s the p5js version then!

Check the available versions on the CDN (last one is 1.4.0):

[https://cdn.jsdelivr.net/npm/p5/lib/](https://cdn.jsdelivr.net/npm/p5/lib/)

[https://cdn.jsdelivr.net/npm/p5@1.4.0/lib/p5.min.js](https://cdn.jsdelivr.net/npm/p5@1.4.0/lib/p5.min.js)

---

<div class="post-metadata">

### Author: ![Omri](https://avatars.discourse-cdn.com/v4/letter/o/bc79bd/32.png) [@Omri](https://discourse.processing.org/u/Omri)
#### Post date: [August 27, 2021, 3:32pm UTC](https://discourse.processing.org/t/textwrap-is-not-defined/31967/10 "2021-08-27T15:32:35Z")

</div>

YES!  
It was that, thank you!

if someone is interesting:

````auto
<head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/p5.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.4.0/addons/p5.sound.min.js"></script>
  <meta charset="utf-8" />
</head>```
````
