---
title: "Discussion on \"Unary Operator\" | Hashnode"
description: "Discussion on \"Unary Operator\". String to number conversion using the unary operator.\nconst a = '10';\n+a  // will print number 10\nLook at below \nconst foo = { valueOf: () => '10' };\n\n+foo  // it will also print 10"
url: "https://hashnode.com/posts/unary-operator/61606dd38e8734462af5e995"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Unary Operator](https://jkpulipati.hashnode.dev/unary-operator?utm_source=hashnode&utm_medium=feed)

String to number conversion using the unary operator. const a = '10'; +a // will print number 10 Look at below const foo = { valueOf: () => '10' }; +foo // it will also print 10

Oct 8, 2021 · 1 min read · jkpulipati.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)

## Written by

[Jaya Krishna Pulipati](https://hashnode.com/@jkpulipati)

@jkpulipati

  
[View profile](https://hashnode.com/@jkpulipati)

Programmer

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
