473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do I define my return value in a while table?

IMPORTANT: This is a homework assignment, so I am not looking for someone to write my code, just looking for guidance on structure.

My JavaScript table generates exactly as I want, but my code is missing the return value and is therefore giving me an undefined comment in addition to the table. I have tried nesting it all within another function, which I assign to the return value, but no change.


Expand|Select|Wrap|Line Numbers
  1. function Trig()    {    
  2.  
  3.     var d, x, decSin, decCos;
  4.     d = 0;  // radians
  5.  
  6.     while (d <= 360) 
  7.     {
  8.         x = Math.PI/180*(d);
  9.  
  10.         decSin = Math.sin(x);
  11.         decCos = Math.cos(x); //
  12.  
  13.         document.write("<tr><td>" + d + "</td><td>" + decSin + "</td><td>" + decCos + "</td></tr>");
  14.  
  15.         d = d+15;
  16.     }    
  17. }
Jul 13 '12 #1
1 1350
Got it

I added before the function closing bracket:

d='';
return d;
Jul 13 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Chris Gilbert | last post by:
I'm quite stuck with this: I have an import table called ReferenceMatchingImport which contains data that has been sucked from a data submission. The contents of this table have to be imported...
11
by: Marcus Jacobs | last post by:
Dear Group I have written a file conversion program that uses strtof to convert text strings to floats. It works as I intended except for my error messages. It is my understanding that strtof...
8
by: Ravindranath Gummadidala | last post by:
Hi All: I am trying to understand the C function call mechanism. Please bear with me as I state what I know: "every invocation of a function causes a frame for that function to be pushed on...
1
by: Capstar | last post by:
Hi NG, I have the following struct, macro and functions prototypes: typedef struct { jmp_buf __env; /*other stuff*/ } SAT; #define smalloc_init(sat_p, size) \
9
by: Steven | last post by:
Hello, I have a question about strcmp(). I have four words, who need to be compared if it were two strings. I tried adding the comparison values like '(strcmp(w1, w2) + strcmp(w3, w4))', where...
11
by: igor.lautar | last post by:
Hi, How can I get the address of return value in function? ex. int function(int argument) { int *arg_address; int *rtn_address;
3
by: John Dann | last post by:
A question that I'm in two minds about - maybe someone more experienced could offer some advice? Let's say I have a method in a class whose function is to generate an image (But it could equally...
1
by: chetan29 | last post by:
hello freinds, I have written a store proc, which update a table in AS400, i want to know how can i make sure the update statement is successful or not. depending on successful flag i want to set...
11
by: polas | last post by:
Good afternoon all, I appreciate that the standard requires that main should return an integer. What I was wondering though is there any accepted standardisation on exactly what value to return...
1
by: Rahul | last post by:
While reading "Efficient C++" by Dov Bulka I came across the follown statement "In addition, you must also define a copy constructor to "turn on" the Return Value Optimization(RVO). If the class...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.