Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #23732
| From | "se" <se@no-one.here> |
|---|---|
| Newsgroups | comp.lang.javascript |
| Subject | Re: Why is it so convoluted to import a .js file in javascript? |
| Date | 2014-03-28 19:00 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <lh4dbg$qv7$1@dont-email.me> (permalink) |
| References | <d1050ce2-5b06-4bb8-9d69-18cc325b30c0@googlegroups.com> <lh20mo$eoc$1@dont-email.me> <5d08d1c6-2291-4c72-957c-07d75b6062b0@googlegroups.com> |
<jonas.thornvall@gmail.com> skrev i meddelelsen
news:5d08d1c6-2291-4c72-957c-07d75b6062b0@googlegroups.com...
> Den torsdagen den 27:e mars 2014 kl. 21:12:29 UTC+1 skrev se:
>> <jonas.thornvall@gmail.com> skrev i meddelelsen
>>
>> news:d1050ce2-5b06-4bb8-9d69-18cc325b30c0@googlegroups.com...
>>
>> >I decided to try math.js
>>
>> >
>>
>> > This is all information on math.js page on howto use it...
>>
>> >
>>
>> >
>>
>> > // load math.js and create an instance
>>
>> > var mathjs = require('math,js'),
>>
>> > math = mathjs()
>>
>> >
>>
>> > So i pretty much guessed that i should copy the text to my script
>>
>> > But i get following error in firefox
>>
>> >
>>
>> > 02 ReferenceError: require is not defined div.html:155
>>
>> > 00:12:49,743 reflow: 7.15ms
>>
>> > 00:12:49,642 TypeError: primearray is undefined //This error is not
>> > there
>>
>> > normally
>>
>> >
>>
>> >
>>
>> > So can anyone explain howto invoke math.js in my script.
>>
>> >
>>
>> >
>>
>> > Why can't a simple
>>
>> > import('../test/test.js'); or append('../test/test.js');
>>
>> > do?
>>
>> >
>>
>> > I mean if it is variable conflicts that prevent this can they not get
>>
>> > renamed on the fly?
>>
>>
>>
>> Go here to learn basics of javascript. But first of; learn basics
>>
>> of html coding same place.
>>
>> http://www.w3schools.com/js/default.asp
>>
>>
>>
>> Make a new page and paste below. Perhaps it'll give you
>>
>> an idea to start off. Put in your own expression:
>>
>>
>>
>> <head>
>>
>> <script type="text/javascript">
>>
>> var expres='(5*3.5-2.5)/3';
>>
>> function mathEval(expres) {
>>
>> document.write(eval(expres));
>>
>> }
>>
>> </script>
>>
>> </head>
>>
>>
>>
>> <body>
>>
>> <button type="button" name="mBut"
>>
>> onclick="mathEval(expres);">Click</button>
>>
>> </body>
>
>
> I was wrong apparently it do +- */ in correct order, but it has problems
> with Powers, no problems i can parse them. I will only do integer
> arithmetics for now so no roots.
Learn to use javascript Math object still same place:
http://www.w3schools.com/jsref/jsref_obj_math.asp
http://www.w3schools.com/jsref/jsref_obj_math.asp
Or put your energy into writing your own mathparser instead of curse and
swear.
Try this:
var res=eval(expres);
document.write(Math.sqrt(res));
// document.write(Math.pow(res,2));
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-26 16:22 -0700
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-27 01:37 -0700
Re: Why is it so convoluted to import a .js file in javascript? Tim Streater <timstreater@greenbee.net> - 2014-03-27 11:45 +0000
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-27 09:36 -0700
Re: Why is it so convoluted to import a .js file in javascript? Tim Streater <timstreater@greenbee.net> - 2014-03-27 17:17 +0000
Re: Why is it so convoluted to import a .js file in javascript? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-27 19:48 +0100
Re: Why is it so convoluted to import a .js file in javascript? "se" <se@no-one.here> - 2014-03-27 20:52 +0100
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 08:39 -0700
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 08:59 -0700
Re: Why is it so convoluted to import a .js file in javascript? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-28 18:19 +0100
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 10:41 -0700
eval() vs. own expression parser (was: Why is it so convoluted to import a .js file in javascript?) Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-28 19:11 +0100
Re: Why is it so convoluted to import a .js file in javascript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-28 21:43 +0100
Re: Why is it so convoluted to import a .js file in javascript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-29 18:57 +0100
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 08:51 -0700
Re: Why is it so convoluted to import a .js file in javascript? Hans-Georg Michna <hans-georgNoEmailPlease@michna.com> - 2014-03-27 17:30 +0100
Re: Why is it so convoluted to import a .js file in javascript? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2014-03-27 09:39 +0100
Re: Why is it so convoluted to import a .js file in javascript? "se" <se@no-one.here> - 2014-03-27 21:12 +0100
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 07:11 -0700
Re: Why is it so convoluted to import a .js file in javascript? John Harris <niam@jghnorth.org.uk.invalid> - 2014-03-28 14:30 +0000
Re: Why is it so convoluted to import a .js file in javascript? danca <cyberdanny@tiscalinet.it> - 2014-03-28 15:36 +0100
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 08:17 -0700
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 08:23 -0700
Re: Why is it so convoluted to import a .js file in javascript? danca <cyberdanny@tiscalinet.it> - 2014-03-29 16:42 +0100
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 09:02 -0700
Re: Why is it so convoluted to import a .js file in javascript? "se" <se@no-one.here> - 2014-03-28 19:00 +0100
Re: Why is it so convoluted to import a .js file in javascript? jonas.thornvall@gmail.com - 2014-03-28 11:34 -0700
Re: Why is it so convoluted to import a .js file in javascript? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-27 22:29 +0100
csiph-web