Evaluate polynomial expression string
JavaScript (ES7), 48 bytes

Based upon a suggestion from @RickHitchcock

Expects X in uppercase. Takes input in currying syntax (p)(X).



p=&gt;X=&gt;eval(p.replace(/[X^]/g,c=&gt;c&lt;{}?'*X':'**'))


Try it online!



JavaScript (ES7), 49 bytes

Same approach as @DeadPossum. Takes input in currying syntax (p)(x).

p=&gt;x=&gt;eval(p.split`x`.join`*x`.split`^`.join`**`)


Try it online!