[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

passing a set of numbers to a function

Matheus Suffi

1/25/2016 12:45:00 PM

I'm in trouble , I need to send a set of numbers to a function , for example: ' 01599874425 ' .
however, when the set of numbers is sent to a function, if the first character is 0, it is deleted .
I do not want that to happen ,is there a javascript function or conversion to not let that happen ?
59 Answers

Aleksandro

1/25/2016 1:51:00 PM

0

On 25/01/16 09:45, Matheus Suffi wrote:
> I'm in trouble , I need to send a set of numbers to a function , for example: ' 01599874425 ' .
> however, when the set of numbers is sent to a function, if the first character is 0, it is deleted .
> I do not want that to happen ,is there a javascript function or conversion to not let that happen ?

As in any scripting language, pass it as a string.

Thomas 'PointedEars' Lahn

1/29/2016 2:58:00 AM

0

Matheus Suffi wrote:

> I'm in trouble , I need to send a set of numbers to a function , for
> example: ' 01599874425 ' .

That is _not_ a set of numbers; it is, at best, a set of (decimal) digits
making up *one* number.

> however, when the set of numbers is sent to a function, if the first
> character is 0, it is deleted .

No, if as posted it most certainly is not. Either you have a strange idea
of what it means to "send" something "to a function" (in proper language,
you _pass_ a _value_ as an _argument_ to a function) or something in the
function code lets the leading zero disappear from the passed value.

Nobody can tell for sure until you post both the expression in which you
call the function, and the function code (passing numbers as strings just
for the sake of it is a bad idea; do not listen to wannabes). You did not
even say why you want to do this. (If this is homework, do your own
homework. We can assist you if you are stuck, but it is rather unlikely
that we do your homework for you.)

> I do not want that to happen ,is there a javascript function or conversion
> to not let that happen ?

1. There is no â??javascriptâ?, see the ECMAScript Support Matrix (URI below).

2. <http://www.catb.org/esr/faqs/smart-question...

3. In English, punctuation is usually not preceded by whitespace. You would
be well-advised to post in an easily readable way because otherwise busy,
knowledgable people tend to skip postings that are not easily readable.

See also the FAQ (URI below).

--
PointedEars
FAQ: <http://PointedEars.... | SVN: <http://PointedEars.de...
Twitter: @PointedEars2 | ES Matrix: <http://PointedEars.de/es-...
Please do not cc me. / Bitte keine Kopien per E-Mail.

JR

1/29/2016 7:20:00 AM

0

In a galaxy far far away, Thomas 'Pointed Ears' Lahn prattled:
> Matheus Suffi wrote:
>
> > I'm in trouble , I need to send a set of numbers to a function , for
> > example: ' 01599874425 ' .
>
> That is _not_ a set of numbers; it is, at best, a set of (decimal) digits
> making up *one* number.

Matheus was just giving an example. No need for bragging about your knowledge in Set Theory. Once again, you're missing the point.


> (If this is homework, do your own
> homework. We can assist you if you are stuck,
> but it is rather unlikely
> that we do your homework for you.)

By "We", Thomas meant "We, the supreme pedantic assholes in the Usenet,", not the c.l.js group.

>
> > I do not want that to happen ,is there a javascript function or conversion
> > to not let that happen ?
>
> 1. There is no "javascript", see the ECMAScript Support Matrix (URI below).

"Pointy Ears" comes again with his usual annoying BS. There is no "PointedEars".

>
> 2. <http://www.catb.org/esr/faqs/smart-question...
>
> 3. In English, punctuation is usually not preceded by whitespace. You would
> be well-advised to post in an easily readable way because otherwise busy,
> knowledgable people tend to skip postings that are not easily readable.

Good. Now the "busy" German troll is lecturing English to foreigners.


<spam>
> See also the FAQ (URI below).
</spam>

Ben Bacarisse

1/29/2016 10:09:00 AM

0

Joao Rodrigues <groups_jr-1@yahoo.com.br> writes:

> In a galaxy far far away, Thomas 'Pointed Ears' Lahn prattled:
>> Matheus Suffi wrote:
>>
>> > I'm in trouble , I need to send a set of numbers to a function , for
>> > example: ' 01599874425 ' .
>>
>> That is _not_ a set of numbers; it is, at best, a set of (decimal) digits
>> making up *one* number.
>
> Matheus was just giving an example. No need for bragging about your
> knowledge in Set Theory. Once again, you're missing the point.

Sets don't contain duplicates so I would not say he's bragging.

<snip>
>> 2. <http://www.catb.org/esr/faqs/smart-question...

How I hate that document. It has some very sounds advice but I never
refer anyone to it because I cringe at the Usenet culture of bullying it
endorses. Usenet needs more smart answers than it needs smart
questions.

<snip>
--
Ben.

John Harris

1/29/2016 10:21:00 AM

0

On Fri, 29 Jan 2016 10:09:17 +0000, Ben Bacarisse
<ben.usenet@bsb.me.uk> wrote:


<snip>
>Sets don't contain duplicates
<snip>

How can you tell?
x is a member; x is a member; x is a member.
Does that tell you if there is duplication, or not? Remember, there's
no other way to look inside a set.

John

Ben Bacarisse

1/29/2016 12:24:00 PM

0

John Harris <niam@jghnorth.org.uk.invalid> writes:

> On Fri, 29 Jan 2016 10:09:17 +0000, Ben Bacarisse
> <ben.usenet@bsb.me.uk> wrote:
>
> <snip>
>>Sets don't contain duplicates
> <snip>
>
> How can you tell?

x not in (S \ {x}). |{x}| = 1. x in S => |S \ {x}| = |S| - 1. These
are inconsistent with my understanding of the metaphor of duplication
(though I accept it might have other nuances for other people).

> x is a member; x is a member; x is a member.
> Does that tell you if there is duplication, or not? Remember, there's
> no other way to look inside a set.

If you are allowed metaphors like "look" and "inside", so am I!

--
Ben.

Aleksandro

1/29/2016 1:32:00 PM

0

On 28/01/16 23:57, Thomas 'PointedEars' Lahn wrote:
> Matheus Suffi wrote:
>
>> I'm in trouble , I need to send a set of numbers to a function , for
>> example: ' 01599874425 ' .
>
> That is _not_ a set of numbers; it is, at best, a set of (decimal) digits
> making up *one* number.
>
>> however, when the set of numbers is sent to a function, if the first
>> character is 0, it is deleted .
>
> No, if as posted it most certainly is not. Either you have a strange idea
> of what it means to "send" something "to a function" (in proper language,
> you _pass_ a _value_ as an _argument_ to a function) or something in the
> function code lets the leading zero disappear from the passed value.
>
> Nobody can tell for sure until you post both the expression in which you
> call the function, and the function code (passing numbers as strings just
> for the sake of it is a bad idea; do not listen to wannabes). You did not
> even say why you want to do this. (If this is homework, do your own
> homework. We can assist you if you are stuck, but it is rather unlikely
> that we do your homework for you.)
>
>> I do not want that to happen ,is there a javascript function or conversion
>> to not let that happen ?
>
> 1. There is no â??javascriptâ?, see the ECMAScript Support Matrix (URI below).
>
> 2. <http://www.catb.org/esr/faqs/smart-question...
>
> 3. In English, punctuation is usually not preceded by whitespace. You would
> be well-advised to post in an easily readable way because otherwise busy,
> knowledgable people tend to skip postings that are not easily readable.
>
> See also the FAQ (URI below).

Matheus, if you want to maximize the usefulness of this site and
minimize the wasted time, I strongly suggest you block Thomas' messages
and all the replies to him. These stupid arguments are common here and
some just keep feeding the troll.

Evertjan.

1/29/2016 1:53:00 PM

0

Aleksandro <aleksandro@gmx.com> wrote on 29 Jan 2016 in comp.lang.javascript:

> Matheus, if you want to maximize the usefulness of this site

Despite the good tiding intended,
there is no site in sight,
this is Usenet.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

John Harris

1/29/2016 2:20:00 PM

0

On Fri, 29 Jan 2016 03:57:49 +0100, Thomas 'PointedEars' Lahn
<PointedEars@web.de> wrote:


<snip>
>1. There is no ?javascript?,
<snip>

I don't understand why Thomas will accept "car" as a general name for
a variety of different things with something in common, but won't
accept "javascript" as a general name for a variety of things with
much in common.

If he wrote "There is no *one* javascript" it would cease to be
obnoxious, though lacking in explanation.

John

Scott Sauyet

1/29/2016 2:26:00 PM

0

Evertjan. wrote:
> Aleksandro wrote:
>
>> Matheus, if you want to maximize the usefulness of this site
>
> Despite the good tiding intended,
> there is no site in sight,
> this is Usenet.

The fact that the World Wide Web is using the word "site" for its
locations does not preclude us from using it in other common ways
found in English, such as a synonym for "location", even for such
an abstraction of "location" that would encompass a USENET group.

See also "forum".

-- Scott