<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/UVgM9ieV1" -->

---
title: 5 Things I Didn’t Know About JavaScript Operators
description: A single unary operator as a prefix, +x or — x , will convert a string to an integer. A positive unary operators, + , will only transform values into integers....
canonical: https://daily.dev/posts/5-things-i-didn-t-know-about-javascript-operators-uvgm9iev1
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: 5 Things I Didn’t Know About JavaScript Operators | daily.dev
og:description: A single unary operator as a prefix, +x or — x , will convert a string to an integer. A positive unary operators, + , will only transform values into integers....
og:url: https://daily.dev/posts/5-things-i-didn-t-know-about-javascript-operators-uvgm9iev1
og:image: https://api.daily.dev/og/posts/UVgM9ieV1.png
og:image:alt: 5 Things I Didn’t Know About JavaScript Operators
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# 5 Things I Didn’t Know About JavaScript Operators

**[JavaScript in Plain English](https://daily.dev/sources/jsPlainEnglish)** · 9 min read · 20 upvotes · 5 comments

## Summary

A single unary operator as a prefix, +x or — x , will convert a string to an integer. A positive unary operators, + , will only transform values into integers. A negative operator, — , will both transform a value into an integer and turn it negative. Two negatives do make a positive, so probably best to just keep to the positive prefix.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://medium.com/javascript-in-plain-english/5-things-i-didnt-know-about-javascript-operators-44bb1d03c71a>

## Community discussion

Top comments from developers on daily.dev.

**@alfreddagenais** · 1 upvotes

> Some time a bit weird to understand, but very helpful to get information. And other great point we need to read more the documentation 😅😂

**@gloarte94** · 0 upvotes

> Very good information

**@iaros** · 0 upvotes

> Very useful. Thank you!

**@ghost** · 0 upvotes

> Great points, helpful for beginners.

---

Tags: [#javascript](https://daily.dev/tags/javascript)

[View this post on daily.dev](https://daily.dev/posts/5-things-i-didn-t-know-about-javascript-operators-uvgm9iev1)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"5 Things I Didn’t Know About JavaScript Operators","url":"https://daily.dev/posts/5-things-i-didn-t-know-about-javascript-operators-uvgm9iev1","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/5-things-i-didn-t-know-about-javascript-operators-uvgm9iev1"},"datePublished":"2020-12-09T08:14:49.407Z","dateModified":"2021-10-07T14:17:10.317Z","description":"A single unary operator as a prefix, +x or — x , will convert a string to an integer. A positive unary operators, + , will only transform values into integers....","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7b635f43a93ccb764600c4aad3f6fd28","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/7b635f43a93ccb764600c4aad3f6fd28","isAccessibleForFree":true,"articleSection":"JavaScript in Plain English","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"JavaScript in Plain English","logo":"https://media.daily.dev/image/upload/s--Dg5QTRuI--/f_auto,q_auto/v1686665538/logos/pe","url":"https://daily.dev/sources/jsPlainEnglish"},"commentCount":5,"discussionUrl":"https://daily.dev/posts/5-things-i-didn-t-know-about-javascript-operators-uvgm9iev1","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":20},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":5}],"keywords":"javascript","timeRequired":"PT9M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"JavaScript in Plain English","item":"https://daily.dev/sources/jsPlainEnglish"},{"@type":"ListItem","position":3,"name":"5 Things I Didn’t Know About JavaScript Operators"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/5-things-i-didn-t-know-about-javascript-operators-uvgm9iev1","comment":[{"@type":"Comment","text":"Some time a bit weird to understand, but very helpful to get information. And other great point we need to read more the documentation 😅😂","datePublished":"2020-12-09T13:30:26.076Z","url":"https://daily.dev/posts/UVgM9ieV1#c-nBykUYv3g","author":{"@type":"Person","name":"Alfred Dagenais","url":"https://daily.dev/alfreddagenais","image":"https://avatars1.githubusercontent.com/u/5769264?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Very good information","datePublished":"2020-12-09T13:13:31.722Z","url":"https://daily.dev/posts/UVgM9ieV1#c-9kz3knEqJ","author":{"@type":"Person","name":"Giuseppe Loarte","url":"https://daily.dev/gloarte94","image":"https://avatars1.githubusercontent.com/u/39068405?v=4"}},{"@type":"Comment","text":"Very useful. Thank you!","datePublished":"2020-12-09T21:48:41.999Z","url":"https://daily.dev/posts/UVgM9ieV1#c-MrnRzJDVi","author":{"@type":"Person","name":"Iaroslav","url":"https://daily.dev/iaros","image":"https://lh3.googleusercontent.com/a-/AAuE7mBael5pTvP9IS0CBBf2sjYhBO_xQ3RW6YpVrPNR6w=s100"}},{"@type":"Comment","text":"Great points, helpful for beginners.","datePublished":"2020-12-09T13:21:10.375Z","url":"https://daily.dev/posts/UVgM9ieV1#c-MPVuDEuPS","author":{"@type":"Person","name":"Deleted user","url":"https://daily.dev/ghost","image":"https://media.daily.dev/image/upload/s--hNIUzLiO--/f_auto/v1705327420/public/ghost_vlftth"}}]}
```

