Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #38400
| Newsgroups | comp.lang.javascript |
|---|---|
| Date | 2020-05-11 11:52 -0700 |
| References | <e5d1fdb0-c8d9-4077-9cd0-445042c1d2d2@googlegroups.com> <e58e0191-c2cc-4faa-bb94-7c2a97e39fd6@googlegroups.com> |
| Message-ID | <bf650290-7dbd-4c0f-b5fb-a0a5567fd190@googlegroups.com> (permalink) |
| Subject | Re: create 2 dimension tuple in Typescript and access items |
| From | JRough <janis.rough@gmail.com> |
Actually Tuple should look like this I think:
let productlist:( string| number|string| string| string)[];
productlist = [ "Samsung Galaxy Note 7",59000, 'Available',"url('MobileCart_Images_part1/SamsungGalaxy_Gold.jpg')" ];
productlist.push( 'Samsung Galaxy S6 Edge',53499,'Available', "url('MobileCart_Images_part1/samsung_edge_silver.JPG')");
productlist.push( 'Nokia Lumia i640XL', 14990, 'Out of Stock',"url('MobileCart_Images_part1/lumia_640xl.jpg')" );
On Monday, May 11, 2020 at 11:06:48 AM UTC-7, JRough wrote:
> ok thanks for your input on the script, for the typescript error, it works now, I took out the word array, i.e,
> const productlist:( number | string| number|string| string| string)[];
>
> On Saturday, May 9, 2020 at 4:49:42 PM UTC-7, JRough wrote:
> > I have 3 rows of data , I want individual items inserted into web page , but on the first line where I define the tuple , I get an error and can't compile typescript?
> >
> > const productlist: Array( number | string| number|boolean| string| string)[]; *****
> >
> > productlist.push(431,"SamsungGalaxyNote7",59000,'Available',"url('MobileCart_Images_part1/SamsungGalaxy_Gold.jpg')","Samsung Galaxy Note 7 is a stylish mobile you can ever have. It has 64GB memory." );
> >
> > productlist.push(433,'SamsungGalaxyS6Edge',53499,'Available',"url('MobileCart_Images_part1/samsung_edge_silver.JPG')", "Samsung Galaxy Edge blah blah blah");
> >
> > productlist.push(434,'NokiaLumiai640XL',14990,'OutofStock',"url('MobileCart_Images_part1/lumia_640xl.jpg')", "Nokia Lumia 640XL blah blah blah" );
> >
> >
> >
> > And here is my script to insert the individual items into the html page:
> >
> > for ( var i = 0; productlist.length > i++){
> > if ( i = 0){
> > document.getElementById("pName0").innerHTML = productlist[i][1] ;
> > document.getElementById("pPrice0").innerHTML = productlist[i][2];
> > document.getElementById("pAvailable0").innerHTML= productlist[i][3];
> > } else if( i = 1) {
> > document.getElementById("pName1").innerHTML = productlist[i][1] ;
> > document.getElementById("pPrice1").innerHTML = productlist[i][2];
> > document.getElementById("pAvailable1").innerHTML= productlist[i][3];
> > }else {
> > document.getElementById("pName2").innerHTML = productlist[i][1] ;
> > document.getElementById("pPrice2").innerHTML = productlist[i][2];
> > document.getElementById("pAvailable2").innerHTML= productlist[i][3];
> >
> > }
> > }
> >
> > thank-you
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
create 2 dimension tuple in Typescript and access items JRough <janis.rough@gmail.com> - 2020-05-09 16:49 -0700
Re: create 2 dimension tuple in Typescript and access items JJ <jj4public@vfemail.net> - 2020-05-10 19:56 +0700
Re: create 2 dimension tuple in Typescript and access items JRough <janis.rough@gmail.com> - 2020-05-10 06:09 -0700
Re: create 2 dimension tuple in Typescript and access items Arno Welzel <usenet@arnowelzel.de> - 2020-05-10 22:56 +0200
Re: create 2 dimension tuple in Typescript and access items JRough <janis.rough@gmail.com> - 2020-05-11 11:06 -0700
Re: create 2 dimension tuple in Typescript and access items JRough <janis.rough@gmail.com> - 2020-05-11 11:52 -0700
Re: create 2 dimension tuple in Typescript and access items "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2020-05-12 14:09 -0700
csiph-web