Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9071697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:58:36+00:00 2026-06-16T17:58:36+00:00

I am trying to work out some obfusicated code by reading it, and I

  • 0

I am trying to work out some obfusicated code by reading it, and I was doing pretty well until a came across this:

a = a && "*"

Now I am still quite new to Javascript and these shortened uncommon javascript codes are still very foreign to me, this is the first time I have come across them.

Does anybody know what this does? I attempted it in a javascript code tester ad it just returned *, so I do not know.

Also, if anybody knows where I can look to find out what these uncommon lines of code do, that would be very helpful. They are all shortened and are sorts of things like this and

a = a || b

(I know what that one does)

But If there is some sort of name for this kind of javascript or a reference I can look at, that would be very helpful, I have been scouring Google for hours.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:58:38+00:00Added an answer on June 16, 2026 at 5:58 pm

    If a is truthy, it assigns "*" to a.

    If a is falsy, it remains untouched.


    && has short-circuit semantics: A compound expression (e1) && (e2)—where e1 and e2 are arbitrary expressions themselves—evaluates to either

    • e1 if e1 evaluates to false in a boolean context—e2 is not evaluated
    • e2 if e1 evaluates to true in a boolean context

    This does not imply that e1 or e2 and the entire expression (e1) && (e2) need evaluate to true or false!

    In a boolean context, the following values evaluate to false as per the spec:

    • null
    • undefined
    • ±0
    • NaN
    • false
    • the empty string

    All1 other values are considered true.

    The above values are succinctly called “falsy” and the others “truthy”.

    Applied to your example: a = a && "*"

    According to the aforementioned rules of short-circuit evaluation for &&, the expression evaluates to a if a is falsy, which is then in turn assigned to a, i.e. the statement simplifies to a = a.

    If a is truthy, however, the expression on the right-hand side evaluates to *, which is in turn assigned to a.


    As for your second question: (e1) || (e2) has similar semantics:

    The entire expression evaluates to:

    • e1 if e1 is truthy
    • e2 if e1 is falsy

    1 Exception

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to work out how to parallelize some code from data mining
I'm trying to work out why some of my test cases (using RhinoMocks 3.6
I am trying to work out some performance problems with some JavaScript I've been
Trying to help a friend out with a friend out with some assembly code,
Trying to work out distance between two points (lat & lng) I have an
I'm trying to work out why this function isn't working by placing a few
I have been trying to work out the bug on this but can't seem
I'm trying to work out some of the finer details of the Full-Text Search
I'm trying to work out how to implement some machine learning library to help
I am trying to work out how to update some D3.js elements just by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.