JavaScript Editor Javascript source editor     Web programming 



Team LiB
Previous Section Next Section

Q&A

Q

Can you include a function call within a double- or single-quoted string, as you can with a variable?

A

No. You must call functions outside quotation marks. However, you can break the string apart and place the function call between the parts of the string, using the concatenation operator to tie them together. For example

$newstring = "I purchased".numPurchase($somenum)." items.";

    Team LiB
    Previous Section Next Section


    JavaScript Editor Javascript source editor     Web programming

    
    R7