473,591 Members | 2,899 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

javascript 'function not defined' error in recursion

1 New Member
hi, i have a problem which recursion fits perfectly, however; after working with the base function (which has no errors and works correctly) the recursions return a "function not defined" error in ff's js console. i tried a few things that came to mind but nothing has changed it... i found some interesting articles on the net regarding javascript's callbacks, and found out that due to callbacks recursion may end up eating a lot more memory than normal recursion does, which makes it sound like js and recursion don't go together.

the second time i call value1(), when it is in the first loop of the recursive function, i get the 'function not defined' error. i also get a not defined error regarding the chars string on that same line if you get past the function error. i'm guessing its related...

any help is appreciated.

<script type="text/javascript">
var chars = "abcdefghijklmn opqrstuvwxyzABC DEFGHIJKLMNOPQR STUVWXYZ";

function value1(baseChar , base, options) {
this.baseChar = baseChar;
this.base = base;

if(options == "")
this.valid = new Array(0);
else {
this.valid = new Array(0);

for(var i=0; i<options.lengt h; i++)
this.valid.push (options.substr ing(i,i+1));

this.child = new Array(0);

function mod() {
var aNum = 0;
var input = "\"eHgMYUn_ MWW[SLZ!kKOiM\\SX[Uif'GcaO]YU`eWPJIv|g`YTV TlrUPQT`R_T MgIO~pcM[QHaQVrYI^u'f,ue HgMYU,";

var v1opt = new value1("", 0, chars);

recurse1(v1opt) ;

function recurse1(v1opt) {
document.write( "base char: "+ v1opt.baseChar +"<br />");
document.write( "base: "+ v1opt.base +"<br />");
document.write( "valid: "+ v1opt.valid.joi n() +"<br />");

for(var i=0; i<v1opt.valid.l ength; i++) {
if((v1opt.base + v1opt.valid[i].charCodeAt(0)) <= 1286) {
document.write( "child: "+ v1opt.valid[i].charAt(0) +"<br /><blockquote>") ;
var a = new value1("", 0, chars);
child = v1opt.child.pus h(a);

for(var j=0; j<chars.length ; j++)
if((child.base + chars.charCodeA t(j)) <= 1286)
child.valid.pus h(chars.charAt( j));

if(v1opt.child. length != 0)
for(var i=0; i<v1opt.child.l ength; i++)
recurse1(v1opt. child(i));

document.write( "</blockquote>");
Jun 21 '06 #1
1 17565
3 New Member
May be th problem is in v1opt.child(i), as if the recursion is working correctly with scalar types. Have U tried to call the recurse1 for any scalar type?
You can assign this object to any variable and try to call for this one.
Jun 22 '06 #2

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

Similar topics

by: Fabian | last post by:
Well, what can I say...I really hate Javascript. I am not programming as profession but I sometimes work with PHP with MySQL, ASP with Ms Access/SQL Server. I have done something in VB and when I was jounger I worked with C. But what happens with Javascript, it happens with no other language. I work with WinXP SP2 & IIS5, now. But also with Win2k and win98, as fas as I remember, it was the same. I always keep my PC updated with
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you get response from a Confirm() popup window to uncheck all server-side checkboxes placed in a panle of a web user control? I am using ASP.Net 2.0, Thanks. Need info...
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause bad breath)? Scope describes the context in which a variable can be used. For example, if a variable's scope is a certain function, then that variable can only be used in that function. If you were to try to access that variable anywhere else in...
by: lielar | last post by:
Hi I'm writing a javascript class object that creates objects of itself. Take for example function One(x){ this.x = x; } One.prototype.addOne = function(x) {
by: Jeff Bigham | last post by:
So, it appears that Javascript has a recursion limit of about 1000 levels on FF, maybe less/more on other browsers. Should such deep recursion then generally be avoided in Javascript? Surprisingly, deep recursion actually isn't that slow for what I'm doing. Programming this task recursively is so much more straightforward to me, but currently I'm forced to use an ugly hack to avoid going over the 1000 level limit. Of course, it could...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.