%13.7lf format in javascript with post ?


    Oct 25 2006 | 10:20 am
    hello,
    just new in javascript mailing list and new in javascript language.
    how can I post values of variables (or print) in Max window with %ld
    or %13.7lf or %s format ?
    and also :
    the best books to learn and practice javascript (english or french) ?
    thanks .
    jh

    • Oct 25 2006 | 12:22 pm
      hi,
      > how can I post values of variables (or print) in Max window with %ld or
      > %13.7lf or %s format ?
      unfortunately there's no printf-style function in javascript.
      look up "toFixed", "toPrecision", and "toExponential" on this page.
      you have to convert the number to a string using these functions and
      then add the resulting strings together with '+'.
      if you really want something more like printf, you could try what this guy did:
      note, i haven't tested to see if toFixed etc. are working in Max/MSP
      but I assume so.
      > the best books to learn and practice javascript (english or french) ?
      Don't know of any myself, but there is SO much info on the web.
      (I rarely use print material these days..)
      Just make sure you filter out the web-specific stuff, and find
      references for the core language. Other than that, all you need to
      know is in the Javascript for Max/MSP manual. (You might want to also
      read an OpenGL manual if you're interested in that.)
      In fact that Mozilla page seems like a good starting place, in terms
      of references:
      (Not everything there will be applicable to Max of course..)
      Personally I found this little guide quite useful too, though it
      assumes a certain amount of knowledge in OO programming:
      Hope this helps!
      Steve
    • Oct 26 2006 | 11:21 am