Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #32243
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2017-01-21 14:50 -0800 |
| References | <070aece9-91e6-45c9-b984-42b3ebedbb2f@googlegroups.com> |
| Message-ID | <fcadb45d-be73-4280-b470-490abee8bf87@googlegroups.com> (permalink) |
| Subject | Re: Javascript save and load "records" |
| From | "Michael Haufe (TNO)" <tno@thenewobjective.com> |
On Saturday, January 21, 2017 at 4:33:17 AM UTC-6, jonas.t...@gmail.com wrote:
> I found some code that both can load and save text and pictures.
>
> But i would like some advice on how to save it like a record "format the data".
>
> I have an array with nodes they certain properties like nodeindex, linkarray, color, position(x,y) etc
>
> Should i just make a string of each entrance and separate with a newline?
>
> function makeNodes()
> {
> for (var m = 0; m <= nodes; m ++ )
> {
> arr[m] ={nodeindex : 0, nroflinks : 0, nodelinks : [], hold : false, rposX : 0, rposY : 0, rwidth : 10, rheigth : 10, rcolor : "red" , bcolor : "green"};
> }
> return arr;
> }
>
> It seem arrays can be extracted to comma separated strings.
> I guess there is nothing like a record in javascript just data types, so you have to format yourself? Will newline do for each entry?
>
> Or is there something like a binary datatype that could be saved? I always go with the easiest option my guess it that a text string is easier to save and load back to the array?
A record is simply a data structure that can be represented as a JavaScript object. Saving the data is a different matter depending on a particular use case (server vs. client. domain vs non-domain specific, etc...)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Javascript save and load "records" jonas.thornvall@gmail.com - 2017-01-21 02:33 -0800
Re: Javascript save and load "records" "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2017-01-21 14:50 -0800
Re: Javascript save and load "records" jonas.thornvall@gmail.com - 2017-01-23 02:42 -0800
csiph-web