# P5.js vs javascript

**URL:** <https://discourse.processing.org/t/p5-js-vs-javascript/11866>\
**Category:** Beginners\
**Created:** [June 5, 2019, 4:31pm UTC](https://discourse.processing.org/t/p5-js-vs-javascript/11866 "2019-06-05T16:31:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![CodingIsLife](https://avatars.discourse-cdn.com/v4/letter/c/6de8d8/32.png) [@CodingIsLife](https://discourse.processing.org/u/CodingIsLife)\
**Post date:** [June 5, 2019, 4:31pm UTC](https://discourse.processing.org/t/p5-js-vs-javascript/11866/1 "2019-06-05T16:31:52Z")

</div>

I started p5.js recently. I never learnt javascript (the main javascript) at all. I have been learning only p5.js for almost 5 months…

But I always had a question in my mind that - “I have not learnt javascript. Can p5.js provide everything the main javascript could??”

Would you please answer it for me??  
If the answer is ‘no’ , then should I learn the main javascript first for the other advantages? Or it’s just enough to be a nice developer by only learning p5.js?

---

<div class="post-metadata">

**Author:** ![janglee](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/janglee/32/4035_2.png) [@janglee](https://discourse.processing.org/u/janglee)\
**Post date:** [June 5, 2019, 5:48pm UTC](https://discourse.processing.org/t/p5-js-vs-javascript/11866/2 "2019-06-05T17:48:49Z")

</div>

P5.js is a **library** , which works on top of javascript. It provides and extends the functionality of js for drawing things. And javascript itself is a programming **language**. When you are using p5.js you are using javascript.  
**You can do all the things that js provides in the sketch**. But probably you have not used most part of js while making sketch.  
I encourage you to learn js. While p5.js is a good start for beginners you need to learn other technologies(remember you do not need to know all.) to be a **nice developer**.

---

<div class="post-metadata">

**Author:** ![InferNova](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/infernova/32/6009_2.png) [@InferNova](https://discourse.processing.org/u/InferNova)\
**Post date:** [June 5, 2019, 6:31pm UTC](https://discourse.processing.org/t/p5-js-vs-javascript/11866/3 "2019-06-05T18:31:37Z")

</div>

Hey There!

P5.js is an extra layer on top of JS like Processing Core on top of Java, it makes things alot easier. You can learn JavaScript if it’s something that yo7 require or are interested to do. But if P5 meets all your criteria it up to you. P5 is another layer of abstraction which can simplify things but does not necessarily have to be better because there can be things maybe which you would like to make differently then how P5 operates. Learning JS really depends what you are looking for / curiosity !

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 5, 2019, 7:10pm UTC](https://discourse.processing.org/t/p5-js-vs-javascript/11866/4 "2019-06-05T19:10:22Z")

</div>

> [@CodingIsLife](#):
>
> … should I learn the main javascript first for the other advantages?

From Wikipedia:

> **[JavaScript](https://en.wikipedia.org/wiki/JavaScript)**
>
> JavaScript (/ˈdʒɑːvəskrɪpt/), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2023\[update\], 98.7% of websites use JavaScript on the client side for webpage behavior, often incorporating third-party libraries. All major web browsers have a dedicated JavaScript engine to execute the code on users' devices.
> JavaScript is a high-level, often just-in-time compiled language that conforms to the ECMAScript stan...

> As a multi-paradigm language, JavaScript supports [event-driven](https://en.wikipedia.org/wiki/Event-driven_programming), [functional](https://en.wikipedia.org/wiki/Functional_programming), and [imperative](https://en.wikipedia.org/wiki/Imperative_programming) (including [object-oriented](https://en.wikipedia.org/wiki/Object-oriented_programming) and [prototype-based](https://en.wikipedia.org/wiki/Prototype-based_programming)) [programming styles](https://en.wikipedia.org/wiki/Programming_paradigm). It has [APIs](https://en.wikipedia.org/wiki/Application_programming_interface) for working with text, [arrays](https://en.wikipedia.org/wiki/Array_data_type), dates, [regular expressions](https://en.wikipedia.org/wiki/Regular_expression), and the [DOM](https://en.wikipedia.org/wiki/Document_Object_Model), …

JS is relatively easy to start w/, but very hard to master, due to its multi-paradigm nature, conflicting programming styles and never-ending competing frameworks (such as React, Angular, etc.)! 😱

For plain-vanilla JS, best reference site is from [Mozilla.org](http://Mozilla.org): 🕶

> **[JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript)**
>
> JavaScript (JS) is a lightweight interpreted (or just-in-time compiled) programming language with first-class functions. While it is most well-known as the scripting language for Web pages, many non-browser environments also use it, such as Node.js,...

> **[Standard built-in objects - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects)**
>
> This chapter documents all of JavaScript's standard, built-in objects, including their methods and properties.

> **[HTML elements reference - HTML: HyperText Markup Language | MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element)**
>
> This page lists all the HTML elements, which are created using tags.

> **[Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API)**
>
> When writing code for the Web, there are a large number of Web APIs available. Below is a list of all the APIs and interfaces (object types) that you may be able to use while developing your Web app or site.

> **[Event reference | MDN](https://developer.mozilla.org/en-US/docs/Web/Events)**
>
> Events are fired to notify code of "interesting changes" that may affect code execution. These can arise from user interactions such as using a mouse or resizing a window, changes in the state of the underlying environment (e.g. low battery or media...

> **[CSS reference - CSS: Cascading Style Sheets | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference)**
>
> Use this CSS reference to browse an alphabetical index of all of the standard CSS properties, pseudo-classes, pseudo-elements, data types, functional notations and at-rules. You can also browse key CSS concepts and a list of selectors organized by...

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [June 5, 2019, 7:32pm UTC](https://discourse.processing.org/t/p5-js-vs-javascript/11866/5 "2019-06-05T19:32:14Z")

</div>

> [@CodingIsLife](#):
>
> Or it’s just enough to be a nice developer by only learning p5.js?

- W/ just p5js, you’re mostly programming in JS using the OOP paradigm style.
- However, you still need to learn HTML & CSS in order to design web pages.
- And to reach industry-level dev, you also need to learn some mainstream framework, such as React, Angular, etc.

There are also some languages which transpile to JS, such as TypeScript, CoffeeScript, etc.:

- [www.TypeScriptLang.org/play](http://www.TypeScriptLang.org/play)
- [CoffeeScript.org](http://CoffeeScript.org)

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [June 7, 2019, 4:26pm UTC](https://discourse.processing.org/t/p5-js-vs-javascript/11866/6 "2019-06-07T16:26:13Z")

</div>

> [@InferNova](#):
>
> P5.js is an extra layer on top of JS like Processing Core on top of Java

This is a good comparison to make, but also a bit misleading.

p5.js is written in valid JavaScript. When you write p5.js, you are writing JavaScript, but using a library.

Processing (Java mode) as documented in sketches and written in PDE with .pde files is _not_ written in valid Java. Processing is its own Java-like dialect, and the contents of pde files must be transformed later into valid Java before it runs on a Java virtual machine. You _can_ use Processing as a Java library (e.g. in Eclipse) and write it using valid Java – for what that looks like, see:

[https://processing.org/tutorials/eclipse/](https://processing.org/tutorials/eclipse/)

However none of the Processing examples or reference documentation demonstrate this valid Java mode – they are all in written in the Processing dialect for PDE.
